From 36f643f3a6de6e7fff3739095a6c203e74fae740 Mon Sep 17 00:00:00 2001 From: chomp Date: Thu, 4 Apr 2024 21:29:42 +0000 Subject: [PATCH] 380 (#24) Co-authored-by: Dev Reviewed-on: https://dev.sp-tarkov.com/chomp/ModExamples/pulls/24 --- README.md | 2 +- TypeScript/10ScopesAndTypes/package.json | 16 +- .../10ScopesAndTypes/types/ErrorHandler.d.ts | 2 +- .../10ScopesAndTypes/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../10ScopesAndTypes/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../10ScopesAndTypes/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/11BundleLoadingSample/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../11BundleLoadingSample/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../12ClassExtensionOverride/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/13AddTrader/package.json | 16 +- TypeScript/13AddTrader/src/mod.ts | 16 +- TypeScript/13AddTrader/src/traderHelpers.ts | 10 +- .../13AddTrader/types/ErrorHandler.d.ts | 2 +- TypeScript/13AddTrader/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/13AddTrader/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../13AddTrader/types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../13AddTrader/types/servers/HttpServer.d.ts | 4 +- .../13AddTrader/types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../13AddTrader/types/utils/HashUtil.d.ts | 3 + .../13AddTrader/types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../13AddTrader/types/utils/RandomUtil.d.ts | 21 +- .../13AddTrader/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/13AddTrader/types/utils/VFS.d.ts | 10 +- .../13AddTrader/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/14AfterDBLoadHook/package.json | 16 +- .../14AfterDBLoadHook/types/ErrorHandler.d.ts | 2 +- .../14AfterDBLoadHook/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../14AfterDBLoadHook/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../14AfterDBLoadHook/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/15HttpListenerExample/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../15HttpListenerExample/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/16ImporterUtil/package.json | 16 +- .../16ImporterUtil/types/ErrorHandler.d.ts | 2 +- TypeScript/16ImporterUtil/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../16ImporterUtil/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../16ImporterUtil/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../16ImporterUtil/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../16ImporterUtil/types/utils/VFS.d.ts | 10 +- .../16ImporterUtil/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/18CustomItemService/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../18CustomItemService/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../18CustomItemService/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../18CustomItemService/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../19UseExternalLibraries/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../19UseExternalLibraries/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/1LogToConsole/package.json | 16 +- .../1LogToConsole/types/ErrorHandler.d.ts | 2 +- TypeScript/1LogToConsole/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/1LogToConsole/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../1LogToConsole/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../1LogToConsole/types/utils/RandomUtil.d.ts | 21 +- .../1LogToConsole/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/1LogToConsole/types/utils/VFS.d.ts | 10 +- .../1LogToConsole/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/20CustomChatBot/package.json | 16 +- .../20CustomChatBot/types/ErrorHandler.d.ts | 2 +- TypeScript/20CustomChatBot/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../20CustomChatBot/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../Dialogue/AbstractDialogueChatBot.d.ts | 20 -- ...ChatCommand.d.ts => ICommandoCommand.d.ts} | 6 +- .../Commando/SptCommandoCommands.d.ts | 4 +- .../Commando/SptCommands/GiveSptCommand.d.ts | 18 +- .../Commando/SptCommands/SavedCommand.d.ts | 6 - .../Dialogue/CommandoDialogueChatBot.d.ts | 15 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../20CustomChatBot/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../20CustomChatBot/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../20CustomChatBot/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../21CustomCommandoCommand/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../Dialogue/AbstractDialogueChatBot.d.ts | 20 -- ...ChatCommand.d.ts => ICommandoCommand.d.ts} | 6 +- .../Commando/SptCommandoCommands.d.ts | 4 +- .../Commando/SptCommands/GiveSptCommand.d.ts | 18 +- .../Commando/SptCommands/SavedCommand.d.ts | 6 - .../Dialogue/CommandoDialogueChatBot.d.ts | 15 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/22CustomAkiCommand/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../22CustomAkiCommand/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../22CustomAkiCommand/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../Dialogue/AbstractDialogueChatBot.d.ts | 20 -- ...ChatCommand.d.ts => ICommandoCommand.d.ts} | 6 +- .../Commando/SptCommandoCommands.d.ts | 4 +- .../Commando/SptCommands/GiveSptCommand.d.ts | 18 +- .../Commando/SptCommands/SavedCommand.d.ts | 6 - .../Dialogue/CommandoDialogueChatBot.d.ts | 15 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../22CustomAkiCommand/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../23CustomAbstractChatBot/package.json | 16 +- TypeScript/2EditDatabase/package.json | 16 +- .../2EditDatabase/types/ErrorHandler.d.ts | 2 +- TypeScript/2EditDatabase/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/2EditDatabase/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../2EditDatabase/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../2EditDatabase/types/utils/RandomUtil.d.ts | 21 +- .../2EditDatabase/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/2EditDatabase/types/utils/VFS.d.ts | 10 +- .../2EditDatabase/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/3GetSptConfigFile/package.json | 16 +- .../3GetSptConfigFile/types/ErrorHandler.d.ts | 2 +- .../3GetSptConfigFile/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../3GetSptConfigFile/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../3GetSptConfigFile/types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/4UseACustomConfigFile/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../4UseACustomConfigFile/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/5ReplaceMethod/package.json | 16 +- .../5ReplaceMethod/types/ErrorHandler.d.ts | 2 +- TypeScript/5ReplaceMethod/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../5ReplaceMethod/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../5ReplaceMethod/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../5ReplaceMethod/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../5ReplaceMethod/types/utils/VFS.d.ts | 10 +- .../5ReplaceMethod/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- .../6ReferenceAnotherClass/package.json | 16 +- .../types/ErrorHandler.d.ts | 2 +- .../6ReferenceAnotherClass/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- .../types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../types/utils/RandomUtil.d.ts | 21 +- .../types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - .../types/utils/VFS.d.ts | 10 +- .../types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/7OnLoadHook/package.json | 16 +- .../7OnLoadHook/types/ErrorHandler.d.ts | 2 +- TypeScript/7OnLoadHook/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/7OnLoadHook/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../7OnLoadHook/types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../7OnLoadHook/types/servers/HttpServer.d.ts | 4 +- .../7OnLoadHook/types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../7OnLoadHook/types/utils/HashUtil.d.ts | 3 + .../7OnLoadHook/types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../7OnLoadHook/types/utils/RandomUtil.d.ts | 21 +- .../7OnLoadHook/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/7OnLoadHook/types/utils/VFS.d.ts | 10 +- .../7OnLoadHook/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/8OnUpdateHook/package.json | 16 +- .../8OnUpdateHook/types/ErrorHandler.d.ts | 2 +- TypeScript/8OnUpdateHook/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/8OnUpdateHook/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../8OnUpdateHook/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../8OnUpdateHook/types/utils/RandomUtil.d.ts | 21 +- .../8OnUpdateHook/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/8OnUpdateHook/types/utils/VFS.d.ts | 10 +- .../8OnUpdateHook/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- TypeScript/9RouterHooks/package.json | 16 +- .../9RouterHooks/types/ErrorHandler.d.ts | 2 +- TypeScript/9RouterHooks/types/Program.d.ts | 2 +- .../types/callbacks/AchievementCallbacks.d.ts | 21 ++ .../types/callbacks/BuildsCallbacks.d.ts | 34 +++ .../types/callbacks/BundleCallbacks.d.ts | 7 +- .../types/callbacks/ClientLogCallbacks.d.ts | 16 +- .../types/callbacks/GameCallbacks.d.ts | 6 +- .../types/callbacks/HideoutCallbacks.d.ts | 8 +- .../types/callbacks/InraidCallbacks.d.ts | 17 ++ .../types/callbacks/InventoryCallbacks.d.ts | 42 +-- .../types/callbacks/ItemEventCallbacks.d.ts | 6 + .../types/callbacks/MatchCallbacks.d.ts | 16 +- .../types/callbacks/PresetBuildCallbacks.d.ts | 26 -- .../types/callbacks/ProfileCallbacks.d.ts | 11 +- .../types/callbacks/RagfairCallbacks.d.ts | 2 +- .../types/callbacks/TraderCallbacks.d.ts | 3 +- .../types/context/ApplicationContext.d.ts | 5 +- .../controllers/AchievementController.d.ts | 23 ++ .../types/controllers/BotController.d.ts | 34 ++- .../types/controllers/BuildController.d.ts | 36 +++ .../types/controllers/DialogueController.d.ts | 2 +- .../types/controllers/GameController.d.ts | 14 +- .../types/controllers/HideoutController.d.ts | 42 +-- .../types/controllers/InraidController.d.ts | 65 ++++- .../controllers/InsuranceController.d.ts | 69 +++-- .../controllers/InventoryController.d.ts | 71 +++--- .../types/controllers/LauncherController.d.ts | 8 +- .../types/controllers/LocationController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 8 +- .../controllers/PresetBuildController.d.ts | 36 --- .../types/controllers/PresetController.d.ts | 4 +- .../types/controllers/ProfileController.d.ts | 17 +- .../types/controllers/QuestController.d.ts | 35 +-- .../types/controllers/RagfairController.d.ts | 67 +++-- .../types/controllers/RepairController.d.ts | 4 +- .../RepeatableQuestController.d.ts | 23 +- .../types/controllers/TradeController.d.ts | 56 +++- .../types/controllers/TraderController.d.ts | 10 +- TypeScript/9RouterHooks/types/di/Router.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 86 +++++-- .../types/generators/BotGenerator.d.ts | 18 +- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 9 +- .../types/generators/BotLootGenerator.d.ts | 58 ++--- .../generators/FenceBaseAssortGenerator.d.ts | 19 +- .../IFilterPlateModsForSlotByLevelResult.d.ts | 11 + .../types/generators/LocationGenerator.d.ts | 6 +- .../types/generators/LootGenerator.d.ts | 38 +-- .../types/generators/PMCLootGenerator.d.ts | 23 +- .../types/generators/PlayerScavGenerator.d.ts | 13 +- .../generators/RagfairAssortGenerator.d.ts | 36 +-- .../generators/RagfairOfferGenerator.d.ts | 53 ++-- .../generators/RepeatableQuestGenerator.d.ts | 117 ++------- .../RepeatableQuestRewardGenerator.d.ts | 106 ++++++++ .../generators/ScavCaseRewardGenerator.d.ts | 25 +- .../types/generators/WeatherGenerator.d.ts | 5 +- .../ExternalInventoryMagGen.d.ts | 6 +- .../types/helpers/AssortHelper.d.ts | 2 +- .../types/helpers/BotGeneratorHelper.d.ts | 50 ++-- .../helpers/BotWeaponGeneratorHelper.d.ts | 29 +-- .../types/helpers/ContainerHelper.d.ts | 5 +- .../helpers/Dialogue/SptDialogueChatBot.d.ts | 2 + .../types/helpers/DialogueHelper.d.ts | 11 +- .../types/helpers/HandbookHelper.d.ts | 8 +- .../types/helpers/HideoutHelper.d.ts | 112 +++++--- .../types/helpers/InRaidHelper.d.ts | 36 ++- .../types/helpers/InventoryHelper.d.ts | 195 ++++++++++---- .../types/helpers/ItemHelper.d.ts | 239 +++++++++++++----- .../types/helpers/PresetHelper.d.ts | 32 ++- .../types/helpers/ProfileHelper.d.ts | 76 +++++- .../types/helpers/QuestConditionHelper.d.ts | 12 +- .../types/helpers/QuestHelper.d.ts | 45 +++- .../types/helpers/RagfairOfferHelper.d.ts | 35 ++- .../types/helpers/RagfairServerHelper.d.ts | 13 +- .../types/helpers/TradeHelper.d.ts | 37 +-- .../types/helpers/TraderAssortHelper.d.ts | 5 + .../types/helpers/TraderHelper.d.ts | 14 +- .../types/ide/BleedingEdgeModsEntry.d.ts | 2 + .../types/loaders/BundleLoader.d.ts | 26 +- .../types/loaders/PostAkiModLoader.d.ts | 10 +- .../types/loaders/PostDBModLoader.d.ts | 8 +- .../types/loaders/PreAkiModLoader.d.ts | 9 +- .../eft/builds/ISetMagazineRequest.d.ts | 9 + .../types/models/eft/common/IGlobals.d.ts | 118 +++++++++ .../types/models/eft/common/ILocation.d.ts | 3 +- .../models/eft/common/ILocationBase.d.ts | 6 + .../types/models/eft/common/IPmcData.d.ts | 8 +- .../eft/common/tables/IAchievement.d.ts | 18 ++ .../models/eft/common/tables/IBotBase.d.ts | 34 ++- .../models/eft/common/tables/IBotType.d.ts | 21 +- .../types/models/eft/common/tables/IItem.d.ts | 4 + .../eft/common/tables/IProfileTemplate.d.ts | 8 +- .../models/eft/common/tables/IQuest.d.ts | 117 +++++---- .../eft/common/tables/IRepeatableQuests.d.ts | 206 +-------------- .../eft/common/tables/ITemplateItem.d.ts | 41 ++- .../models/eft/common/tables/ITrader.d.ts | 6 +- .../models/eft/hideout/IHideoutArea.d.ts | 6 +- .../eft/hideout/IHideoutProduction.d.ts | 1 + ...deoutSingleProductionStartRequestData.d.ts | 1 + .../types/models/eft/hideout/IQteData.d.ts | 116 +++++++-- .../eft/inRaid/IItemDeliveryRequestData.d.ts | 5 + .../eft/inventory/IAddItemDirectRequest.d.ts | 8 + .../eft/inventory/IAddItemRequestData.d.ts | 2 +- .../eft/inventory/IAddItemsDirectRequest.d.ts | 10 + .../IInventoryUnbindRequestData.d.ts | 6 + .../IOpenRandomLootContainerRequestData.d.ts | 2 +- .../eft/inventory/ISetFavoriteItems.d.ts | 6 + .../itemEvent/IItemEventRouterResponse.d.ts | 1 + .../eft/match/IDeclineGroupInviteRequest.d.ts | 2 + .../IGetRaidConfigurationRequestData.d.ts | 2 + .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 1 - .../types/models/eft/profile/IAkiProfile.d.ts | 68 +++-- .../ICompletedAchievementsResponse.d.ts | 3 + .../eft/profile/IGetAchievementsResponse.d.ts | 4 + .../eft/profile/IGetOtherProfileRequest.d.ts | 3 + .../eft/profile/IGetOtherProfileResponse.d.ts | 40 +++ .../eft/quests/IFailQuestRequestData.d.ts | 2 +- .../trade/IProcessBuyTradeRequestData.d.ts | 2 +- .../IProcessRagfairTradeRequestData.d.ts | 8 +- .../ISellScavItemsToFenceRequestData.d.ts | 1 + .../models/eft/weather/IWeatherData.d.ts | 1 + .../types/models/enums/BackendErrorCodes.d.ts | 6 +- .../types/models/enums/BaseClasses.d.ts | 16 +- .../types/models/enums/BonusSkillType.d.ts | 7 + .../types/models/enums/BonusType.d.ts | 33 +++ .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/ELocationName.d.ts | 1 + .../types/models/enums/ItemEventActions.d.ts | 4 +- .../types/models/enums/MessageType.d.ts | 3 +- .../types/models/enums/ModSpawn.d.ts | 5 + .../types/models/enums/SeasonalEventType.d.ts | 3 +- .../types/models/enums/TraderServiceType.d.ts | 8 + .../types/models/enums/Traders.d.ts | 3 +- .../models/enums/WildSpawnTypeNumber.d.ts | 13 +- .../models/enums/hideout/QteActivityType.d.ts | 3 + .../models/enums/hideout/QteEffectType.d.ts | 5 + .../models/enums/hideout/QteResultType.d.ts | 4 + .../models/enums/hideout/QteRewardType.d.ts | 6 + .../types/models/enums/hideout/QteType.d.ts | 3 + .../models/enums/hideout/RequirementType.d.ts | 12 + .../models/external/IPostAkiLoadMod.d.ts | 2 +- .../models/external/IPostAkiLoadModAsync.d.ts | 2 +- .../types/models/external/IPostDBLoadMod.d.ts | 2 +- .../models/external/IPostDBLoadModAsync.d.ts | 2 +- .../types/models/external/IPreAkiLoadMod.d.ts | 2 +- .../models/external/IPreAkiLoadModAsync.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 9 +- .../types/models/spt/bots/IBotLootCache.d.ts | 21 +- .../IChooseRandomCompatibleModResult.d.ts | 7 + .../spt/bots/IItemSpawnLimitSettings.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 5 +- .../types/models/spt/config/IBTRConfig.d.ts | 13 + .../types/models/spt/config/IBaseConfig.d.ts | 4 + .../types/models/spt/config/IBotConfig.d.ts | 51 +++- .../models/spt/config/IBotDurability.d.ts | 3 + .../types/models/spt/config/ICoreConfig.d.ts | 33 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +- .../models/spt/config/IInRaidConfig.d.ts | 6 + .../models/spt/config/IInsuranceConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../models/spt/config/ILocaleConfig.d.ts | 3 + .../models/spt/config/ILocationConfig.d.ts | 10 + .../models/spt/config/ILostOnDeathConfig.d.ts | 1 + .../models/spt/config/IPlayerScavConfig.d.ts | 2 +- .../types/models/spt/config/IPmcConfig.d.ts | 8 +- .../models/spt/config/IRagfairConfig.d.ts | 48 ++-- .../spt/config/ISeasonalEventConfig.d.ts | 3 + .../models/spt/config/ITraderConfig.d.ts | 24 +- .../models/spt/config/IWeatherConfig.d.ts | 1 + .../fence/IFenceAssortGenerationValues.d.ts | 9 + .../models/spt/generators/IBotGenerator.d.ts | 5 - .../models/spt/logging/LogTextColor.d.ts | 2 +- .../models/spt/mod/IPackageJsonData.d.ts | 1 + .../models/spt/server/ExhaustableArray.d.ts | 17 ++ .../models/spt/server/IDatabaseTables.d.ts | 7 +- .../types/models/spt/server/ILocations.d.ts | 41 ++- .../spt/services/IInsuranceEquipmentPkg.d.ts | 8 + .../spt/services/ITraderServiceModel.d.ts | 18 ++ .../models/spt/services/LootRequest.d.ts | 3 +- .../models/spt/utils/IUuidGenerator.d.ts | 3 - .../types/routers/ItemEventRouter.d.ts | 4 +- .../item_events/HideoutItemEventRouter.d.ts | 2 +- .../item_events/InventoryItemEventRouter.d.ts | 2 +- .../PresetBuildItemEventRouter.d.ts | 10 - .../static/AchievementStaticRouter.d.ts | 6 + .../routers/static/BuildStaticRouter.d.ts | 6 + .../routers/static/PresetStaticRouter.d.ts | 6 - .../types/servers/HttpServer.d.ts | 4 +- .../types/servers/SaveServer.d.ts | 3 +- .../types/servers/WebSocketServer.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 4 +- .../services/BotGenerationCacheService.d.ts | 13 + .../types/services/BotLootCacheService.d.ts | 12 +- .../types/services/FenceService.d.ts | 139 +++++++--- .../types/services/HashCacheService.d.ts | 30 --- .../types/services/InsuranceService.d.ts | 74 +++--- .../types/services/ItemFilterService.d.ts | 11 + .../types/services/LocaleService.d.ts | 14 +- .../types/services/LocalisationService.d.ts | 2 - .../types/services/MatchLocationService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 6 +- .../types/services/PaymentService.d.ts | 29 +-- .../services/PmcChatResponseService.d.ts | 4 +- .../types/services/ProfileFixerService.d.ts | 18 +- .../types/services/RagfairOfferService.d.ts | 17 +- .../types/services/RagfairPriceService.d.ts | 34 ++- .../services/RagfairRequiredItemsService.d.ts | 3 +- .../types/services/RagfairTaxService.d.ts | 10 + .../types/services/RepairService.d.ts | 11 +- .../types/services/SeasonalEventService.d.ts | 29 ++- .../TraderPurchasePersisterService.d.ts | 12 +- .../types/services/TraderServicesService.d.ts | 13 + .../cache/BundleHashCacheService.d.ts | 18 ++ .../services/cache/ModHashCacheService.d.ts | 18 ++ .../types/services/mod/CustomItemService.d.ts | 9 +- .../9RouterHooks/types/utils/HashUtil.d.ts | 3 + .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/utils/HttpResponseUtil.d.ts | 7 + .../types/utils/RagfairOfferHolder.d.ts | 6 +- .../9RouterHooks/types/utils/RandomUtil.d.ts | 21 +- .../9RouterHooks/types/utils/TimeUtil.d.ts | 56 +++- .../types/utils/UUidGenerator.d.ts | 4 - TypeScript/9RouterHooks/types/utils/VFS.d.ts | 10 +- .../9RouterHooks/types/utils/Watermark.d.ts | 4 +- .../utils/collections/lists/LinkedList.d.ts | 82 ++++-- .../types/utils/collections/lists/Nodes.d.ts | 6 + .../types/utils/collections/queue/Queue.d.ts | 19 +- .../utils/logging/AbstractWinstonLogger.d.ts | 4 +- .../utils/logging/WinstonMainLogger.d.ts | 4 +- .../utils/logging/WinstonRequestLogger.d.ts | 4 +- 5614 files changed, 77106 insertions(+), 38681 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/13AddTrader/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/13AddTrader/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/13AddTrader/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/13AddTrader/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/13AddTrader/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/13AddTrader/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/13AddTrader/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/13AddTrader/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/13AddTrader/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/13AddTrader/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/13AddTrader/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/13AddTrader/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/13AddTrader/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/13AddTrader/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/13AddTrader/types/services/HashCacheService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/13AddTrader/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/13AddTrader/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/16ImporterUtil/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/16ImporterUtil/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/16ImporterUtil/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/16ImporterUtil/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/16ImporterUtil/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/16ImporterUtil/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/16ImporterUtil/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/16ImporterUtil/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/16ImporterUtil/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts create mode 100644 TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/16ImporterUtil/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/16ImporterUtil/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/16ImporterUtil/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/18CustomItemService/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/18CustomItemService/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/18CustomItemService/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/18CustomItemService/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/18CustomItemService/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/18CustomItemService/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/18CustomItemService/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/18CustomItemService/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/18CustomItemService/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/18CustomItemService/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/18CustomItemService/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/18CustomItemService/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/18CustomItemService/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/18CustomItemService/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/18CustomItemService/types/services/HashCacheService.d.ts create mode 100644 TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/18CustomItemService/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/18CustomItemService/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/18CustomItemService/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/18CustomItemService/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/services/HashCacheService.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/19UseExternalLibraries/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/1LogToConsole/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/1LogToConsole/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/1LogToConsole/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/1LogToConsole/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/1LogToConsole/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/1LogToConsole/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/1LogToConsole/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/1LogToConsole/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/1LogToConsole/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/1LogToConsole/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/1LogToConsole/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/1LogToConsole/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/1LogToConsole/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/1LogToConsole/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/1LogToConsole/types/services/HashCacheService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/1LogToConsole/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/1LogToConsole/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/20CustomChatBot/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/20CustomChatBot/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/20CustomChatBot/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/20CustomChatBot/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/20CustomChatBot/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/20CustomChatBot/types/generators/RepeatableQuestRewardGenerator.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts rename TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/{IChatCommand.d.ts => ICommandoCommand.d.ts} (75%) delete mode 100644 TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts create mode 100644 TypeScript/20CustomChatBot/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/20CustomChatBot/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/20CustomChatBot/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/20CustomChatBot/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/services/HashCacheService.d.ts create mode 100644 TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/20CustomChatBot/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/20CustomChatBot/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/20CustomChatBot/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/20CustomChatBot/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestRewardGenerator.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts rename TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/{IChatCommand.d.ts => ICommandoCommand.d.ts} (75%) delete mode 100644 TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/services/HashCacheService.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/21CustomCommandoCommand/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/21CustomCommandoCommand/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestRewardGenerator.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts rename TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/{IChatCommand.d.ts => ICommandoCommand.d.ts} (75%) delete mode 100644 TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/services/HashCacheService.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/22CustomAkiCommand/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/22CustomAkiCommand/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/2EditDatabase/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/2EditDatabase/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/2EditDatabase/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/2EditDatabase/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/2EditDatabase/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/2EditDatabase/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/2EditDatabase/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/2EditDatabase/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/2EditDatabase/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/2EditDatabase/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/2EditDatabase/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/2EditDatabase/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/2EditDatabase/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/2EditDatabase/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/2EditDatabase/types/services/HashCacheService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/2EditDatabase/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/2EditDatabase/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/HashCacheService.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/7OnLoadHook/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/7OnLoadHook/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/7OnLoadHook/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/7OnLoadHook/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/7OnLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/7OnLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/7OnLoadHook/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/7OnLoadHook/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/7OnLoadHook/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/7OnLoadHook/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/utils/collections/lists/Nodes.d.ts create mode 100644 TypeScript/9RouterHooks/types/callbacks/AchievementCallbacks.d.ts create mode 100644 TypeScript/9RouterHooks/types/callbacks/BuildsCallbacks.d.ts delete mode 100644 TypeScript/9RouterHooks/types/callbacks/PresetBuildCallbacks.d.ts create mode 100644 TypeScript/9RouterHooks/types/controllers/AchievementController.d.ts create mode 100644 TypeScript/9RouterHooks/types/controllers/BuildController.d.ts delete mode 100644 TypeScript/9RouterHooks/types/controllers/PresetBuildController.d.ts create mode 100644 TypeScript/9RouterHooks/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts create mode 100644 TypeScript/9RouterHooks/types/generators/RepeatableQuestRewardGenerator.d.ts create mode 100644 TypeScript/9RouterHooks/types/ide/BleedingEdgeModsEntry.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/builds/ISetMagazineRequest.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/common/tables/IAchievement.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemDirectRequest.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemsDirectRequest.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/inventory/ISetFavoriteItems.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/match/IDeclineGroupInviteRequest.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/profile/ICompletedAchievementsResponse.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/profile/IGetAchievementsResponse.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileRequest.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/BonusSkillType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/BonusType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/ModSpawn.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/TraderServiceType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/QteActivityType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/QteEffectType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/QteResultType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/QteRewardType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/QteType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/hideout/RequirementType.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/bots/IItemSpawnLimitSettings.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/config/IBTRConfig.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/fence/IFenceAssortGenerationValues.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/server/ExhaustableArray.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/services/IInsuranceEquipmentPkg.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/services/ITraderServiceModel.d.ts delete mode 100644 TypeScript/9RouterHooks/types/models/spt/utils/IUuidGenerator.d.ts delete mode 100644 TypeScript/9RouterHooks/types/routers/item_events/PresetBuildItemEventRouter.d.ts create mode 100644 TypeScript/9RouterHooks/types/routers/static/AchievementStaticRouter.d.ts create mode 100644 TypeScript/9RouterHooks/types/routers/static/BuildStaticRouter.d.ts delete mode 100644 TypeScript/9RouterHooks/types/routers/static/PresetStaticRouter.d.ts delete mode 100644 TypeScript/9RouterHooks/types/services/HashCacheService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/cache/ModHashCacheService.d.ts delete mode 100644 TypeScript/9RouterHooks/types/utils/UUidGenerator.d.ts create mode 100644 TypeScript/9RouterHooks/types/utils/collections/lists/Nodes.d.ts diff --git a/README.md b/README.md index ebde58d..5143b86 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mod examples for v3.7.6 +# Mod examples for v3.8.0 A collection of example mods that perform typical actions in SPT diff --git a/TypeScript/10ScopesAndTypes/package.json b/TypeScript/10ScopesAndTypes/package.json index 2e42849..5abbcc1 100644 --- a/TypeScript/10ScopesAndTypes/package.json +++ b/TypeScript/10ScopesAndTypes/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts b/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts +++ b/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/10ScopesAndTypes/types/Program.d.ts b/TypeScript/10ScopesAndTypes/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/10ScopesAndTypes/types/Program.d.ts +++ b/TypeScript/10ScopesAndTypes/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/10ScopesAndTypes/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts b/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts +++ b/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/AchievementController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BuildController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/10ScopesAndTypes/types/controllers/PresetBuildController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/10ScopesAndTypes/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/10ScopesAndTypes/types/controllers/PresetController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/PresetController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/ProfileController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/ProfileController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/10ScopesAndTypes/types/di/Router.d.ts b/TypeScript/10ScopesAndTypes/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/10ScopesAndTypes/types/di/Router.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/10ScopesAndTypes/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/10ScopesAndTypes/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ContainerHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestConditionHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/10ScopesAndTypes/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/10ScopesAndTypes/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PostAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocation.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/IPmcData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IItem.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IQteData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BonusSkillType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BonusType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ELocationName.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/ELocationName.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/MessageType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/MessageType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ModSpawn.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/SeasonalEventType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/TraderServiceType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/Traders.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/Traders.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotDurability.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocations.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/10ScopesAndTypes/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/10ScopesAndTypes/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/10ScopesAndTypes/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/10ScopesAndTypes/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/10ScopesAndTypes/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/10ScopesAndTypes/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/10ScopesAndTypes/types/services/MatchLocationService.d.ts b/TypeScript/10ScopesAndTypes/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/10ScopesAndTypes/types/services/MatchLocationService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairTaxService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairTaxService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts b/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts b/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/cache/ModHashCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/mod/CustomItemService.d.ts b/TypeScript/10ScopesAndTypes/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/10ScopesAndTypes/types/utils/HashUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/HashUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/UUidGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/10ScopesAndTypes/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/10ScopesAndTypes/types/utils/VFS.d.ts b/TypeScript/10ScopesAndTypes/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/VFS.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/10ScopesAndTypes/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/collections/lists/Nodes.d.ts b/TypeScript/10ScopesAndTypes/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/10ScopesAndTypes/types/utils/collections/queue/Queue.d.ts b/TypeScript/10ScopesAndTypes/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/10ScopesAndTypes/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/11BundleLoadingSample/package.json b/TypeScript/11BundleLoadingSample/package.json index d3c9291..24673f5 100644 --- a/TypeScript/11BundleLoadingSample/package.json +++ b/TypeScript/11BundleLoadingSample/package.json @@ -5,7 +5,7 @@ "license": "MIT", "main": "src/mod.js", "isBundleMod": true, - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -16,16 +16,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts b/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts +++ b/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/11BundleLoadingSample/types/Program.d.ts b/TypeScript/11BundleLoadingSample/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/11BundleLoadingSample/types/Program.d.ts +++ b/TypeScript/11BundleLoadingSample/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/11BundleLoadingSample/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts b/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts +++ b/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/AchievementController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BuildController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/11BundleLoadingSample/types/controllers/PresetBuildController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/11BundleLoadingSample/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/11BundleLoadingSample/types/controllers/PresetController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/PresetController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/ProfileController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/ProfileController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/11BundleLoadingSample/types/di/Router.d.ts b/TypeScript/11BundleLoadingSample/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/11BundleLoadingSample/types/di/Router.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/11BundleLoadingSample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/11BundleLoadingSample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ContainerHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestConditionHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/11BundleLoadingSample/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/11BundleLoadingSample/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PostAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocation.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/IPmcData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IItem.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IQteData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BonusSkillType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BonusType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ELocationName.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/ELocationName.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/MessageType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/MessageType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ModSpawn.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/SeasonalEventType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/TraderServiceType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/Traders.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/Traders.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotDurability.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocations.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/11BundleLoadingSample/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/11BundleLoadingSample/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/11BundleLoadingSample/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/11BundleLoadingSample/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/11BundleLoadingSample/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/11BundleLoadingSample/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/11BundleLoadingSample/types/services/MatchLocationService.d.ts b/TypeScript/11BundleLoadingSample/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/11BundleLoadingSample/types/services/MatchLocationService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairTaxService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairTaxService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts b/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts b/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/cache/ModHashCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/mod/CustomItemService.d.ts b/TypeScript/11BundleLoadingSample/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/11BundleLoadingSample/types/utils/HashUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/HashUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/UUidGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/11BundleLoadingSample/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/11BundleLoadingSample/types/utils/VFS.d.ts b/TypeScript/11BundleLoadingSample/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/VFS.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/11BundleLoadingSample/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/collections/lists/Nodes.d.ts b/TypeScript/11BundleLoadingSample/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/11BundleLoadingSample/types/utils/collections/queue/Queue.d.ts b/TypeScript/11BundleLoadingSample/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/11BundleLoadingSample/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/12ClassExtensionOverride/package.json b/TypeScript/12ClassExtensionOverride/package.json index ec009dd..de1f0cc 100644 --- a/TypeScript/12ClassExtensionOverride/package.json +++ b/TypeScript/12ClassExtensionOverride/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts b/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/Program.d.ts b/TypeScript/12ClassExtensionOverride/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/12ClassExtensionOverride/types/Program.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts b/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/AchievementController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BuildController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/PresetBuildController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/12ClassExtensionOverride/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/PresetController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/PresetController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/ProfileController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/ProfileController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/12ClassExtensionOverride/types/di/Router.d.ts b/TypeScript/12ClassExtensionOverride/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/Router.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/12ClassExtensionOverride/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ContainerHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestConditionHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/12ClassExtensionOverride/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/12ClassExtensionOverride/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PostAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocation.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IPmcData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IItem.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IQteData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BonusSkillType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BonusType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ELocationName.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/ELocationName.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/MessageType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/MessageType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ModSpawn.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/SeasonalEventType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/TraderServiceType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/Traders.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/Traders.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotDurability.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocations.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/12ClassExtensionOverride/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/12ClassExtensionOverride/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/12ClassExtensionOverride/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/12ClassExtensionOverride/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/12ClassExtensionOverride/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/MatchLocationService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/MatchLocationService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairTaxService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairTaxService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/cache/ModHashCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/mod/CustomItemService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/12ClassExtensionOverride/types/utils/HashUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/HashUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/UUidGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/12ClassExtensionOverride/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/VFS.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/VFS.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/Nodes.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/collections/queue/Queue.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/13AddTrader/package.json b/TypeScript/13AddTrader/package.json index e361abb..2d162d9 100644 --- a/TypeScript/13AddTrader/package.json +++ b/TypeScript/13AddTrader/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Shirito", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/13AddTrader/src/mod.ts b/TypeScript/13AddTrader/src/mod.ts index 2608d2a..216e359 100644 --- a/TypeScript/13AddTrader/src/mod.ts +++ b/TypeScript/13AddTrader/src/mod.ts @@ -16,7 +16,7 @@ import { JsonUtil } from "@spt-aki/utils/JsonUtil"; // New trader settings import * as baseJson from "../db/base.json"; import { TraderHelper } from "./traderHelpers"; -import { FluentAssortConstructor } from "./fluentTraderAssortCreator"; +import { FluentAssortConstructor as FluentAssortCreator } from "./fluentTraderAssortCreator"; import { Money } from "@spt-aki/models/enums/Money"; import { Traders } from "@spt-aki/models/enums/Traders"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -26,7 +26,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod private mod: string private logger: ILogger private traderHelper: TraderHelper - private fluentTraderAssortHeper: FluentAssortConstructor + private fluentAssortCreator: FluentAssortCreator constructor() { this.mod = "13AddTrader"; // Set name of mod so we can log it to console later @@ -52,9 +52,9 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod // Create helper class and use it to register our traders image/icon + set its stock refresh time this.traderHelper = new TraderHelper(); - this.fluentTraderAssortHeper = new FluentAssortConstructor(hashUtil, this.logger); + this.fluentAssortCreator = new FluentAssortCreator(hashUtil, this.logger); this.traderHelper.registerProfileImage(baseJson, this.mod, preAkiModLoader, imageRouter, "cat.jpg"); - this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, 3600); + this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, 3600, 4000); // Add trader to trader enum Traders[baseJson._id] = baseJson._id; @@ -86,7 +86,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod // Add milk const MILK_ID = "575146b724597720a27126d5"; // Can find item ids in `database\templates\items.json` or with https://db.sp-tarkov.com/search - this.fluentTraderAssortHeper.createSingleAssortItem(MILK_ID) + this.fluentAssortCreator.createSingleAssortItem(MILK_ID) .addStackCount(200) .addBuyRestriction(10) .addMoneyCost(Money.ROUBLES, 2000) @@ -96,7 +96,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod // Add 3x bitcoin + salewa for milk barter const BITCOIN_ID = "59faff1d86f7746c51718c9c" const SALEWA_ID = "544fb45d4bdc2dee738b4568"; - this.fluentTraderAssortHeper.createSingleAssortItem(MILK_ID) + this.fluentAssortCreator.createSingleAssortItem(MILK_ID) .addStackCount(100) .addBarterCost(BITCOIN_ID, 3) .addBarterCost(SALEWA_ID, 1) @@ -105,7 +105,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod // Add glock as money purchase - this.fluentTraderAssortHeper.createComplexAssortItem(this.traderHelper.createGlock()) + this.fluentAssortCreator.createComplexAssortItem(this.traderHelper.createGlock()) .addUnlimitedStackCount() .addMoneyCost(Money.ROUBLES, 20000) .addBuyRestriction(3) @@ -113,7 +113,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod .export(tables.traders[baseJson._id]); // Add mp133 preset as mayo barter - this.fluentTraderAssortHeper.createComplexAssortItem(tables.globals.ItemPresets["584148f2245977598f1ad387"]._items) + this.fluentAssortCreator.createComplexAssortItem(tables.globals.ItemPresets["584148f2245977598f1ad387"]._items) .addStackCount(200) .addBarterCost("5bc9b156d4351e00367fbce9", 1) .addBuyRestriction(3) diff --git a/TypeScript/13AddTrader/src/traderHelpers.ts b/TypeScript/13AddTrader/src/traderHelpers.ts index 31b6d1b..eacbffd 100644 --- a/TypeScript/13AddTrader/src/traderHelpers.ts +++ b/TypeScript/13AddTrader/src/traderHelpers.ts @@ -28,14 +28,18 @@ export class TraderHelper * Add record to trader config to set the refresh time of trader in seconds (default is 60 minutes) * @param traderConfig trader config to add our trader to * @param baseJson json file for trader (db/base.json) - * @param refreshTimeSeconds How many sections between trader stock refresh + * @param refreshTimeSecondsMin How many seconds between trader stock refresh min time + * @param refreshTimeSecondsMax How many seconds between trader stock refresh max time */ - public setTraderUpdateTime(traderConfig: ITraderConfig, baseJson: any, refreshTimeSeconds: number): void + public setTraderUpdateTime(traderConfig: ITraderConfig, baseJson: any, refreshTimeSecondsMin: number, refreshTimeSecondsMax: number): void { // Add refresh time in seconds to config const traderRefreshRecord: UpdateTime = { traderId: baseJson._id, - seconds: refreshTimeSeconds }; + seconds: { + min: refreshTimeSecondsMin, + max: refreshTimeSecondsMax + } }; traderConfig.updateTime.push(traderRefreshRecord); } diff --git a/TypeScript/13AddTrader/types/ErrorHandler.d.ts b/TypeScript/13AddTrader/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/13AddTrader/types/ErrorHandler.d.ts +++ b/TypeScript/13AddTrader/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/13AddTrader/types/Program.d.ts b/TypeScript/13AddTrader/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/13AddTrader/types/Program.d.ts +++ b/TypeScript/13AddTrader/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/13AddTrader/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/13AddTrader/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/13AddTrader/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/13AddTrader/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/13AddTrader/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/13AddTrader/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/13AddTrader/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/13AddTrader/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/13AddTrader/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/13AddTrader/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts b/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts +++ b/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/13AddTrader/types/controllers/AchievementController.d.ts b/TypeScript/13AddTrader/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/13AddTrader/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/13AddTrader/types/controllers/BotController.d.ts b/TypeScript/13AddTrader/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/13AddTrader/types/controllers/BotController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/13AddTrader/types/controllers/BuildController.d.ts b/TypeScript/13AddTrader/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/13AddTrader/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts b/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/13AddTrader/types/controllers/PresetBuildController.d.ts b/TypeScript/13AddTrader/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/13AddTrader/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/13AddTrader/types/controllers/PresetController.d.ts b/TypeScript/13AddTrader/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/13AddTrader/types/controllers/PresetController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/13AddTrader/types/controllers/ProfileController.d.ts b/TypeScript/13AddTrader/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/13AddTrader/types/controllers/ProfileController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/13AddTrader/types/controllers/RepairController.d.ts b/TypeScript/13AddTrader/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/13AddTrader/types/controllers/RepairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/13AddTrader/types/controllers/TradeController.d.ts b/TypeScript/13AddTrader/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/13AddTrader/types/controllers/TradeController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/13AddTrader/types/di/Router.d.ts b/TypeScript/13AddTrader/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/13AddTrader/types/di/Router.d.ts +++ b/TypeScript/13AddTrader/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/13AddTrader/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/13AddTrader/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/13AddTrader/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts b/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/13AddTrader/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/13AddTrader/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/13AddTrader/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/13AddTrader/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/13AddTrader/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/13AddTrader/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/13AddTrader/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts b/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/13AddTrader/types/helpers/QuestConditionHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/13AddTrader/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/13AddTrader/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/13AddTrader/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/13AddTrader/types/loaders/PostAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/13AddTrader/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/13AddTrader/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/13AddTrader/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/13AddTrader/types/models/eft/common/ILocation.d.ts b/TypeScript/13AddTrader/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/IPmcData.d.ts b/TypeScript/13AddTrader/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IItem.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/13AddTrader/types/models/eft/hideout/IQteData.d.ts b/TypeScript/13AddTrader/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/13AddTrader/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/13AddTrader/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/13AddTrader/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/13AddTrader/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/13AddTrader/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/13AddTrader/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/13AddTrader/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/13AddTrader/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/13AddTrader/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/13AddTrader/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/13AddTrader/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/13AddTrader/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/13AddTrader/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/13AddTrader/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/13AddTrader/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/13AddTrader/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/13AddTrader/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/13AddTrader/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/13AddTrader/types/models/enums/BonusSkillType.d.ts b/TypeScript/13AddTrader/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/13AddTrader/types/models/enums/BonusType.d.ts b/TypeScript/13AddTrader/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/13AddTrader/types/models/enums/ELocationName.d.ts b/TypeScript/13AddTrader/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/13AddTrader/types/models/enums/ELocationName.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts b/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/13AddTrader/types/models/enums/MessageType.d.ts b/TypeScript/13AddTrader/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/13AddTrader/types/models/enums/MessageType.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/13AddTrader/types/models/enums/ModSpawn.d.ts b/TypeScript/13AddTrader/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/13AddTrader/types/models/enums/SeasonalEventType.d.ts b/TypeScript/13AddTrader/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/13AddTrader/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/13AddTrader/types/models/enums/TraderServiceType.d.ts b/TypeScript/13AddTrader/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/13AddTrader/types/models/enums/Traders.d.ts b/TypeScript/13AddTrader/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/13AddTrader/types/models/enums/Traders.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/QteType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/13AddTrader/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/13AddTrader/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/13AddTrader/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/13AddTrader/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/13AddTrader/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/13AddTrader/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/13AddTrader/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/13AddTrader/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/13AddTrader/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/13AddTrader/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/13AddTrader/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/13AddTrader/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/13AddTrader/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/13AddTrader/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/13AddTrader/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/13AddTrader/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/13AddTrader/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/13AddTrader/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/13AddTrader/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/13AddTrader/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/13AddTrader/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/13AddTrader/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/13AddTrader/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotDurability.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/13AddTrader/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/13AddTrader/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/13AddTrader/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/13AddTrader/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/13AddTrader/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/13AddTrader/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/13AddTrader/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/13AddTrader/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/13AddTrader/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/13AddTrader/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/13AddTrader/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/13AddTrader/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/13AddTrader/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/13AddTrader/types/models/spt/server/ILocations.d.ts b/TypeScript/13AddTrader/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/13AddTrader/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/13AddTrader/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/13AddTrader/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/13AddTrader/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/13AddTrader/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/13AddTrader/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/13AddTrader/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/13AddTrader/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/13AddTrader/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/13AddTrader/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/13AddTrader/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/13AddTrader/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/13AddTrader/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/13AddTrader/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/13AddTrader/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/13AddTrader/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/13AddTrader/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/13AddTrader/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/13AddTrader/types/servers/SaveServer.d.ts b/TypeScript/13AddTrader/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/13AddTrader/types/servers/SaveServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts b/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/13AddTrader/types/services/HashCacheService.d.ts b/TypeScript/13AddTrader/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/13AddTrader/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts +++ b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts b/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/13AddTrader/types/services/LocaleService.d.ts b/TypeScript/13AddTrader/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/13AddTrader/types/services/LocaleService.d.ts +++ b/TypeScript/13AddTrader/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/13AddTrader/types/services/LocalisationService.d.ts b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/13AddTrader/types/services/LocalisationService.d.ts +++ b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/13AddTrader/types/services/MatchLocationService.d.ts b/TypeScript/13AddTrader/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/13AddTrader/types/services/MatchLocationService.d.ts +++ b/TypeScript/13AddTrader/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/13AddTrader/types/services/PaymentService.d.ts b/TypeScript/13AddTrader/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/13AddTrader/types/services/PaymentService.d.ts +++ b/TypeScript/13AddTrader/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts b/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/13AddTrader/types/services/RagfairTaxService.d.ts b/TypeScript/13AddTrader/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/13AddTrader/types/services/RagfairTaxService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/13AddTrader/types/services/RepairService.d.ts b/TypeScript/13AddTrader/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/13AddTrader/types/services/RepairService.d.ts +++ b/TypeScript/13AddTrader/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts b/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts +++ b/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts b/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/13AddTrader/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/13AddTrader/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/13AddTrader/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/13AddTrader/types/services/cache/ModHashCacheService.d.ts b/TypeScript/13AddTrader/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/13AddTrader/types/services/mod/CustomItemService.d.ts b/TypeScript/13AddTrader/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/13AddTrader/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/13AddTrader/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/13AddTrader/types/utils/HashUtil.d.ts b/TypeScript/13AddTrader/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/13AddTrader/types/utils/HashUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts b/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts b/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts b/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/13AddTrader/types/utils/UUidGenerator.d.ts b/TypeScript/13AddTrader/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/13AddTrader/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/13AddTrader/types/utils/VFS.d.ts b/TypeScript/13AddTrader/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/13AddTrader/types/utils/VFS.d.ts +++ b/TypeScript/13AddTrader/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/13AddTrader/types/utils/Watermark.d.ts b/TypeScript/13AddTrader/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/13AddTrader/types/utils/Watermark.d.ts +++ b/TypeScript/13AddTrader/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/13AddTrader/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/13AddTrader/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/13AddTrader/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/13AddTrader/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/13AddTrader/types/utils/collections/lists/Nodes.d.ts b/TypeScript/13AddTrader/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/13AddTrader/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/13AddTrader/types/utils/collections/queue/Queue.d.ts b/TypeScript/13AddTrader/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/13AddTrader/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/13AddTrader/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/13AddTrader/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/13AddTrader/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/13AddTrader/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/13AddTrader/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/13AddTrader/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/13AddTrader/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/13AddTrader/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/13AddTrader/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/13AddTrader/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/13AddTrader/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/13AddTrader/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/13AddTrader/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/14AfterDBLoadHook/package.json b/TypeScript/14AfterDBLoadHook/package.json index 6de8eae..2114056 100644 --- a/TypeScript/14AfterDBLoadHook/package.json +++ b/TypeScript/14AfterDBLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts b/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/Program.d.ts b/TypeScript/14AfterDBLoadHook/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/14AfterDBLoadHook/types/Program.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts b/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/AchievementController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BuildController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/PresetBuildController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/14AfterDBLoadHook/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/PresetController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/PresetController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/ProfileController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/ProfileController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/14AfterDBLoadHook/types/di/Router.d.ts b/TypeScript/14AfterDBLoadHook/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/Router.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/14AfterDBLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ContainerHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestConditionHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/14AfterDBLoadHook/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/14AfterDBLoadHook/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PostAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocation.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IPmcData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IItem.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IQteData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BonusSkillType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BonusType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ELocationName.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/ELocationName.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/MessageType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/MessageType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ModSpawn.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/SeasonalEventType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/TraderServiceType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/Traders.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/Traders.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotDurability.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocations.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/14AfterDBLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/14AfterDBLoadHook/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/14AfterDBLoadHook/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/14AfterDBLoadHook/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/14AfterDBLoadHook/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/MatchLocationService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/MatchLocationService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairTaxService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairTaxService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/cache/ModHashCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/mod/CustomItemService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/14AfterDBLoadHook/types/utils/HashUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/HashUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/UUidGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/14AfterDBLoadHook/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/14AfterDBLoadHook/types/utils/VFS.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/VFS.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/Nodes.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/14AfterDBLoadHook/types/utils/collections/queue/Queue.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/15HttpListenerExample/package.json b/TypeScript/15HttpListenerExample/package.json index c4d94c0..bbbf885 100644 --- a/TypeScript/15HttpListenerExample/package.json +++ b/TypeScript/15HttpListenerExample/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Alex", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts b/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts +++ b/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/15HttpListenerExample/types/Program.d.ts b/TypeScript/15HttpListenerExample/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/15HttpListenerExample/types/Program.d.ts +++ b/TypeScript/15HttpListenerExample/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/15HttpListenerExample/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/15HttpListenerExample/types/callbacks/BundleCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/15HttpListenerExample/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/15HttpListenerExample/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/15HttpListenerExample/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts b/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts +++ b/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/15HttpListenerExample/types/controllers/AchievementController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/BuildController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/PresetBuildController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/15HttpListenerExample/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/15HttpListenerExample/types/controllers/PresetController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/PresetController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/ProfileController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/ProfileController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/15HttpListenerExample/types/controllers/RepairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RepairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/15HttpListenerExample/types/di/Router.d.ts b/TypeScript/15HttpListenerExample/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/15HttpListenerExample/types/di/Router.d.ts +++ b/TypeScript/15HttpListenerExample/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/15HttpListenerExample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/15HttpListenerExample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/ContainerHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestConditionHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/15HttpListenerExample/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/15HttpListenerExample/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/15HttpListenerExample/types/loaders/PostAkiModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/15HttpListenerExample/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/ILocation.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/ILocationBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/IPmcData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IItem.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IQteData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BonusSkillType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BonusType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ELocationName.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/ELocationName.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/MessageType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/MessageType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ModSpawn.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/SeasonalEventType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/TraderServiceType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/Traders.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/Traders.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotDurability.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/server/ILocations.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/15HttpListenerExample/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/15HttpListenerExample/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/15HttpListenerExample/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/15HttpListenerExample/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/15HttpListenerExample/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/15HttpListenerExample/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/15HttpListenerExample/types/services/MatchLocationService.d.ts b/TypeScript/15HttpListenerExample/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/15HttpListenerExample/types/services/MatchLocationService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts b/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairTaxService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairTaxService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/15HttpListenerExample/types/services/RepairService.d.ts b/TypeScript/15HttpListenerExample/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/15HttpListenerExample/types/services/RepairService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts b/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts b/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/15HttpListenerExample/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/cache/ModHashCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/mod/CustomItemService.d.ts b/TypeScript/15HttpListenerExample/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/15HttpListenerExample/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/15HttpListenerExample/types/utils/HashUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/15HttpListenerExample/types/utils/HashUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/15HttpListenerExample/types/utils/HttpFileUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/15HttpListenerExample/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/utils/TimeUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/15HttpListenerExample/types/utils/TimeUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/15HttpListenerExample/types/utils/UUidGenerator.d.ts b/TypeScript/15HttpListenerExample/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/15HttpListenerExample/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/15HttpListenerExample/types/utils/VFS.d.ts b/TypeScript/15HttpListenerExample/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/15HttpListenerExample/types/utils/VFS.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/15HttpListenerExample/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/15HttpListenerExample/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/15HttpListenerExample/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/15HttpListenerExample/types/utils/collections/lists/Nodes.d.ts b/TypeScript/15HttpListenerExample/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/15HttpListenerExample/types/utils/collections/queue/Queue.d.ts b/TypeScript/15HttpListenerExample/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/15HttpListenerExample/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/15HttpListenerExample/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/15HttpListenerExample/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/15HttpListenerExample/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/15HttpListenerExample/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/15HttpListenerExample/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/15HttpListenerExample/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/15HttpListenerExample/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/15HttpListenerExample/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/16ImporterUtil/package.json b/TypeScript/16ImporterUtil/package.json index ca0439e..d14d3f0 100644 --- a/TypeScript/16ImporterUtil/package.json +++ b/TypeScript/16ImporterUtil/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/16ImporterUtil/types/ErrorHandler.d.ts b/TypeScript/16ImporterUtil/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/16ImporterUtil/types/ErrorHandler.d.ts +++ b/TypeScript/16ImporterUtil/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/16ImporterUtil/types/Program.d.ts b/TypeScript/16ImporterUtil/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/16ImporterUtil/types/Program.d.ts +++ b/TypeScript/16ImporterUtil/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/16ImporterUtil/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/16ImporterUtil/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/16ImporterUtil/types/callbacks/BundleCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/16ImporterUtil/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/16ImporterUtil/types/callbacks/InraidCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/MatchCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/16ImporterUtil/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/16ImporterUtil/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/16ImporterUtil/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/16ImporterUtil/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/16ImporterUtil/types/callbacks/TraderCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/16ImporterUtil/types/context/ApplicationContext.d.ts b/TypeScript/16ImporterUtil/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/16ImporterUtil/types/context/ApplicationContext.d.ts +++ b/TypeScript/16ImporterUtil/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/16ImporterUtil/types/controllers/AchievementController.d.ts b/TypeScript/16ImporterUtil/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts b/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/16ImporterUtil/types/controllers/BuildController.d.ts b/TypeScript/16ImporterUtil/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts b/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts b/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts b/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/16ImporterUtil/types/controllers/PresetBuildController.d.ts b/TypeScript/16ImporterUtil/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/16ImporterUtil/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/16ImporterUtil/types/controllers/PresetController.d.ts b/TypeScript/16ImporterUtil/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/16ImporterUtil/types/controllers/PresetController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/16ImporterUtil/types/controllers/ProfileController.d.ts b/TypeScript/16ImporterUtil/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/16ImporterUtil/types/controllers/ProfileController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/16ImporterUtil/types/controllers/RepairController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RepairController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/16ImporterUtil/types/controllers/TradeController.d.ts b/TypeScript/16ImporterUtil/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/TradeController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/controllers/TraderController.d.ts b/TypeScript/16ImporterUtil/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/16ImporterUtil/types/controllers/TraderController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/16ImporterUtil/types/di/Router.d.ts b/TypeScript/16ImporterUtil/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/16ImporterUtil/types/di/Router.d.ts +++ b/TypeScript/16ImporterUtil/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/16ImporterUtil/types/generators/BotLevelGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/16ImporterUtil/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/16ImporterUtil/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/16ImporterUtil/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/16ImporterUtil/types/generators/PlayerScavGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/16ImporterUtil/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/16ImporterUtil/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/16ImporterUtil/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/16ImporterUtil/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/16ImporterUtil/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/16ImporterUtil/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/16ImporterUtil/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/16ImporterUtil/types/helpers/AssortHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/16ImporterUtil/types/helpers/AssortHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/16ImporterUtil/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/16ImporterUtil/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/16ImporterUtil/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/16ImporterUtil/types/helpers/PresetHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/16ImporterUtil/types/helpers/PresetHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/16ImporterUtil/types/helpers/QuestConditionHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/16ImporterUtil/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/16ImporterUtil/types/helpers/RagfairServerHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/16ImporterUtil/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderAssortHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/16ImporterUtil/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/16ImporterUtil/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/16ImporterUtil/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/16ImporterUtil/types/loaders/PostAkiModLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/16ImporterUtil/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/16ImporterUtil/types/loaders/PostDBModLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/16ImporterUtil/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/16ImporterUtil/types/loaders/PreAkiModLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/16ImporterUtil/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/16ImporterUtil/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/IGlobals.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/ILocation.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/ILocationBase.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/IPmcData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IItem.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/16ImporterUtil/types/models/eft/hideout/IQteData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/16ImporterUtil/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/16ImporterUtil/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/16ImporterUtil/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/16ImporterUtil/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts b/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/16ImporterUtil/types/models/enums/BonusSkillType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/BonusType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/ConfigTypes.d.ts b/TypeScript/16ImporterUtil/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/16ImporterUtil/types/models/enums/ELocationName.d.ts b/TypeScript/16ImporterUtil/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/ELocationName.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/16ImporterUtil/types/models/enums/ItemEventActions.d.ts b/TypeScript/16ImporterUtil/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/16ImporterUtil/types/models/enums/MessageType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/MessageType.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/16ImporterUtil/types/models/enums/ModSpawn.d.ts b/TypeScript/16ImporterUtil/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/SeasonalEventType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/16ImporterUtil/types/models/enums/TraderServiceType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/Traders.d.ts b/TypeScript/16ImporterUtil/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/Traders.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/QteType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/16ImporterUtil/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/16ImporterUtil/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IBotDurability.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/16ImporterUtil/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/16ImporterUtil/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/16ImporterUtil/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/16ImporterUtil/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/16ImporterUtil/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/16ImporterUtil/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/16ImporterUtil/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/16ImporterUtil/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/16ImporterUtil/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/16ImporterUtil/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/16ImporterUtil/types/models/spt/server/ILocations.d.ts b/TypeScript/16ImporterUtil/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/16ImporterUtil/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/16ImporterUtil/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/16ImporterUtil/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/16ImporterUtil/types/routers/ItemEventRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/16ImporterUtil/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/16ImporterUtil/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/16ImporterUtil/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/16ImporterUtil/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/16ImporterUtil/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/16ImporterUtil/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/16ImporterUtil/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/16ImporterUtil/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/16ImporterUtil/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/16ImporterUtil/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/16ImporterUtil/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/16ImporterUtil/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/16ImporterUtil/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/16ImporterUtil/types/servers/HttpServer.d.ts b/TypeScript/16ImporterUtil/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/16ImporterUtil/types/servers/HttpServer.d.ts +++ b/TypeScript/16ImporterUtil/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/16ImporterUtil/types/servers/SaveServer.d.ts b/TypeScript/16ImporterUtil/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/16ImporterUtil/types/servers/SaveServer.d.ts +++ b/TypeScript/16ImporterUtil/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/16ImporterUtil/types/servers/WebSocketServer.d.ts b/TypeScript/16ImporterUtil/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/16ImporterUtil/types/servers/WebSocketServer.d.ts +++ b/TypeScript/16ImporterUtil/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts b/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts b/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/16ImporterUtil/types/services/LocaleService.d.ts b/TypeScript/16ImporterUtil/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/16ImporterUtil/types/services/LocaleService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts b/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/16ImporterUtil/types/services/MatchLocationService.d.ts b/TypeScript/16ImporterUtil/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/16ImporterUtil/types/services/MatchLocationService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts b/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts b/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts b/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/16ImporterUtil/types/services/RagfairOfferService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairOfferService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/16ImporterUtil/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/16ImporterUtil/types/services/RagfairTaxService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairTaxService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/16ImporterUtil/types/services/RepairService.d.ts b/TypeScript/16ImporterUtil/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/16ImporterUtil/types/services/RepairService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/16ImporterUtil/types/services/SeasonalEventService.d.ts b/TypeScript/16ImporterUtil/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/16ImporterUtil/types/services/SeasonalEventService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/16ImporterUtil/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/16ImporterUtil/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/16ImporterUtil/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts b/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/16ImporterUtil/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/16ImporterUtil/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/16ImporterUtil/types/services/cache/ModHashCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/16ImporterUtil/types/services/mod/CustomItemService.d.ts b/TypeScript/16ImporterUtil/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/16ImporterUtil/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/16ImporterUtil/types/utils/HashUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/16ImporterUtil/types/utils/HashUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/16ImporterUtil/types/utils/HttpFileUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/16ImporterUtil/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/16ImporterUtil/types/utils/HttpResponseUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/16ImporterUtil/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts b/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/16ImporterUtil/types/utils/TimeUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/16ImporterUtil/types/utils/TimeUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/16ImporterUtil/types/utils/UUidGenerator.d.ts b/TypeScript/16ImporterUtil/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/16ImporterUtil/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/16ImporterUtil/types/utils/VFS.d.ts b/TypeScript/16ImporterUtil/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/16ImporterUtil/types/utils/VFS.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/16ImporterUtil/types/utils/Watermark.d.ts b/TypeScript/16ImporterUtil/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/16ImporterUtil/types/utils/Watermark.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/16ImporterUtil/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/16ImporterUtil/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/16ImporterUtil/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/16ImporterUtil/types/utils/collections/lists/Nodes.d.ts b/TypeScript/16ImporterUtil/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/16ImporterUtil/types/utils/collections/queue/Queue.d.ts b/TypeScript/16ImporterUtil/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/16ImporterUtil/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/16ImporterUtil/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/16ImporterUtil/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/16ImporterUtil/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/16ImporterUtil/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/16ImporterUtil/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/16ImporterUtil/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/16ImporterUtil/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/16ImporterUtil/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/16ImporterUtil/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/package.json b/TypeScript/17AsyncImporterWithDependency1/package.json index 4e1fe43..c497832 100644 --- a/TypeScript/17AsyncImporterWithDependency1/package.json +++ b/TypeScript/17AsyncImporterWithDependency1/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -18,16 +18,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/ErrorHandler.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/ErrorHandler.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/Program.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/Program.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BundleCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InraidCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/MatchCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/TraderCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/context/ApplicationContext.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/context/ApplicationContext.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/AchievementController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/BuildController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetBuildController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/ProfileController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/ProfileController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepairController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/TradeController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/TradeController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/TraderController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/TraderController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/di/Router.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/di/Router.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLevelGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/PlayerScavGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/AssortHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/AssortHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ContainerHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/PresetHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/PresetHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestConditionHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairServerHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderAssortHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/17AsyncImporterWithDependency1/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostAkiModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostDBModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PreAkiModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IGlobals.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocation.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocationBase.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IPmcData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IItem.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IQteData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusSkillType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ConfigTypes.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ELocationName.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ELocationName.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ItemEventActions.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/MessageType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/MessageType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ModSpawn.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/SeasonalEventType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/TraderServiceType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/Traders.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/Traders.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotDurability.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ILocations.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/ItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/servers/HttpServer.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/servers/HttpServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/servers/SaveServer.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/servers/SaveServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/17AsyncImporterWithDependency1/types/servers/WebSocketServer.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/servers/WebSocketServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/LocaleService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/LocaleService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/MatchLocationService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/MatchLocationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairOfferService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairOfferService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairTaxService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairTaxService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RepairService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RepairService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/SeasonalEventService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/SeasonalEventService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/cache/ModHashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/mod/CustomItemService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/HashUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/HashUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpFileUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpResponseUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/TimeUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/TimeUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/UUidGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/VFS.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/VFS.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/Watermark.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/Watermark.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/Nodes.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/queue/Queue.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/package.json b/TypeScript/17AsyncImporterWithDependency2/package.json index 98c7082..715a441 100644 --- a/TypeScript/17AsyncImporterWithDependency2/package.json +++ b/TypeScript/17AsyncImporterWithDependency2/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/ErrorHandler.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/ErrorHandler.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/Program.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/Program.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BundleCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InraidCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/MatchCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/TraderCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/context/ApplicationContext.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/context/ApplicationContext.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/AchievementController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/BuildController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetBuildController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/ProfileController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/ProfileController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepairController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/TradeController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/TradeController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/TraderController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/TraderController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/di/Router.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/di/Router.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLevelGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/PlayerScavGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/AssortHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/AssortHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ContainerHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/PresetHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/PresetHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestConditionHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairServerHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderAssortHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/17AsyncImporterWithDependency2/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostAkiModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostDBModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PreAkiModLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IGlobals.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocation.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocationBase.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IPmcData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IItem.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IQteData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusSkillType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ConfigTypes.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ELocationName.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ELocationName.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ItemEventActions.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/MessageType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/MessageType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ModSpawn.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/SeasonalEventType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/TraderServiceType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/Traders.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/Traders.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotDurability.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ILocations.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/ItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/servers/HttpServer.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/servers/HttpServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/servers/SaveServer.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/servers/SaveServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/17AsyncImporterWithDependency2/types/servers/WebSocketServer.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/servers/WebSocketServer.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/LocaleService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/LocaleService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/MatchLocationService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/MatchLocationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairOfferService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairOfferService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairTaxService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairTaxService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RepairService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RepairService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/SeasonalEventService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/SeasonalEventService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/cache/ModHashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/mod/CustomItemService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/HashUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/HashUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpFileUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpResponseUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/TimeUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/TimeUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/UUidGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/VFS.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/VFS.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/Watermark.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/Watermark.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/Nodes.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/queue/Queue.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/18CustomItemService/package.json b/TypeScript/18CustomItemService/package.json index ae6309a..8fdb837 100644 --- a/TypeScript/18CustomItemService/package.json +++ b/TypeScript/18CustomItemService/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Choccy", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/18CustomItemService/types/ErrorHandler.d.ts b/TypeScript/18CustomItemService/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/18CustomItemService/types/ErrorHandler.d.ts +++ b/TypeScript/18CustomItemService/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/18CustomItemService/types/Program.d.ts b/TypeScript/18CustomItemService/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/18CustomItemService/types/Program.d.ts +++ b/TypeScript/18CustomItemService/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/18CustomItemService/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/18CustomItemService/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/18CustomItemService/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/18CustomItemService/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/18CustomItemService/types/callbacks/BundleCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/18CustomItemService/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/18CustomItemService/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/18CustomItemService/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/18CustomItemService/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/18CustomItemService/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/18CustomItemService/types/callbacks/InraidCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/18CustomItemService/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/18CustomItemService/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/18CustomItemService/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/18CustomItemService/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/18CustomItemService/types/callbacks/MatchCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/18CustomItemService/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/18CustomItemService/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/18CustomItemService/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/18CustomItemService/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/18CustomItemService/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/18CustomItemService/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/18CustomItemService/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/18CustomItemService/types/callbacks/TraderCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/18CustomItemService/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/18CustomItemService/types/context/ApplicationContext.d.ts b/TypeScript/18CustomItemService/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/18CustomItemService/types/context/ApplicationContext.d.ts +++ b/TypeScript/18CustomItemService/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/18CustomItemService/types/controllers/AchievementController.d.ts b/TypeScript/18CustomItemService/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/18CustomItemService/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/18CustomItemService/types/controllers/BotController.d.ts b/TypeScript/18CustomItemService/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/18CustomItemService/types/controllers/BotController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/18CustomItemService/types/controllers/BuildController.d.ts b/TypeScript/18CustomItemService/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/18CustomItemService/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts b/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/18CustomItemService/types/controllers/GameController.d.ts b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/18CustomItemService/types/controllers/GameController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts b/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/18CustomItemService/types/controllers/LauncherController.d.ts b/TypeScript/18CustomItemService/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/18CustomItemService/types/controllers/LauncherController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts b/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts b/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/18CustomItemService/types/controllers/PresetBuildController.d.ts b/TypeScript/18CustomItemService/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/18CustomItemService/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/18CustomItemService/types/controllers/PresetController.d.ts b/TypeScript/18CustomItemService/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/18CustomItemService/types/controllers/PresetController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/18CustomItemService/types/controllers/ProfileController.d.ts b/TypeScript/18CustomItemService/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/18CustomItemService/types/controllers/ProfileController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts b/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/18CustomItemService/types/controllers/RepairController.d.ts b/TypeScript/18CustomItemService/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/18CustomItemService/types/controllers/RepairController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts b/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/18CustomItemService/types/controllers/TradeController.d.ts b/TypeScript/18CustomItemService/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/18CustomItemService/types/controllers/TradeController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/controllers/TraderController.d.ts b/TypeScript/18CustomItemService/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/18CustomItemService/types/controllers/TraderController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/18CustomItemService/types/di/Router.d.ts b/TypeScript/18CustomItemService/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/18CustomItemService/types/di/Router.d.ts +++ b/TypeScript/18CustomItemService/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/18CustomItemService/types/generators/BotInventoryGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/18CustomItemService/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/18CustomItemService/types/generators/BotLevelGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/18CustomItemService/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/18CustomItemService/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/18CustomItemService/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/18CustomItemService/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/18CustomItemService/types/generators/PlayerScavGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/18CustomItemService/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/18CustomItemService/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/18CustomItemService/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/18CustomItemService/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/18CustomItemService/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/18CustomItemService/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/18CustomItemService/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/18CustomItemService/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/18CustomItemService/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/18CustomItemService/types/helpers/AssortHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/18CustomItemService/types/helpers/AssortHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/18CustomItemService/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/18CustomItemService/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/18CustomItemService/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/18CustomItemService/types/helpers/DialogueHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/18CustomItemService/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/18CustomItemService/types/helpers/PresetHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/18CustomItemService/types/helpers/PresetHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/18CustomItemService/types/helpers/QuestConditionHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/18CustomItemService/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/18CustomItemService/types/helpers/RagfairServerHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/18CustomItemService/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/18CustomItemService/types/helpers/TraderAssortHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/18CustomItemService/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/18CustomItemService/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/18CustomItemService/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/18CustomItemService/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/18CustomItemService/types/loaders/PostAkiModLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/18CustomItemService/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/18CustomItemService/types/loaders/PostDBModLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/18CustomItemService/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/18CustomItemService/types/loaders/PreAkiModLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/18CustomItemService/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/18CustomItemService/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/18CustomItemService/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/common/IGlobals.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/ILocation.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/ILocationBase.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/IPmcData.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IItem.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/18CustomItemService/types/models/eft/hideout/IQteData.d.ts b/TypeScript/18CustomItemService/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/18CustomItemService/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/18CustomItemService/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/18CustomItemService/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/18CustomItemService/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/18CustomItemService/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/18CustomItemService/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/18CustomItemService/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/18CustomItemService/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/18CustomItemService/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/18CustomItemService/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/18CustomItemService/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/18CustomItemService/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/18CustomItemService/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/18CustomItemService/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/18CustomItemService/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/18CustomItemService/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/18CustomItemService/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/18CustomItemService/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/18CustomItemService/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/18CustomItemService/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/18CustomItemService/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/18CustomItemService/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/18CustomItemService/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/18CustomItemService/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/18CustomItemService/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/18CustomItemService/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/18CustomItemService/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts b/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/18CustomItemService/types/models/enums/BonusSkillType.d.ts b/TypeScript/18CustomItemService/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/BonusType.d.ts b/TypeScript/18CustomItemService/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/ConfigTypes.d.ts b/TypeScript/18CustomItemService/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/18CustomItemService/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/18CustomItemService/types/models/enums/ELocationName.d.ts b/TypeScript/18CustomItemService/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/18CustomItemService/types/models/enums/ELocationName.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/18CustomItemService/types/models/enums/ItemEventActions.d.ts b/TypeScript/18CustomItemService/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/18CustomItemService/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/18CustomItemService/types/models/enums/MessageType.d.ts b/TypeScript/18CustomItemService/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/18CustomItemService/types/models/enums/MessageType.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/18CustomItemService/types/models/enums/ModSpawn.d.ts b/TypeScript/18CustomItemService/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/18CustomItemService/types/models/enums/SeasonalEventType.d.ts b/TypeScript/18CustomItemService/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/18CustomItemService/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/18CustomItemService/types/models/enums/TraderServiceType.d.ts b/TypeScript/18CustomItemService/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/Traders.d.ts b/TypeScript/18CustomItemService/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/18CustomItemService/types/models/enums/Traders.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/18CustomItemService/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/18CustomItemService/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/18CustomItemService/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/QteType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/18CustomItemService/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/18CustomItemService/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/18CustomItemService/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/18CustomItemService/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/18CustomItemService/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/18CustomItemService/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/18CustomItemService/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/18CustomItemService/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/18CustomItemService/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/18CustomItemService/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/18CustomItemService/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/18CustomItemService/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/18CustomItemService/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/18CustomItemService/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/18CustomItemService/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/18CustomItemService/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IBotConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IBotDurability.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/18CustomItemService/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/18CustomItemService/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/18CustomItemService/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/18CustomItemService/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/18CustomItemService/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/18CustomItemService/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/18CustomItemService/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/18CustomItemService/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/18CustomItemService/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/18CustomItemService/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/18CustomItemService/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/18CustomItemService/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/18CustomItemService/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/18CustomItemService/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/18CustomItemService/types/models/spt/server/ILocations.d.ts b/TypeScript/18CustomItemService/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/18CustomItemService/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/18CustomItemService/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/18CustomItemService/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/18CustomItemService/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/18CustomItemService/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/18CustomItemService/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/18CustomItemService/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/18CustomItemService/types/routers/ItemEventRouter.d.ts b/TypeScript/18CustomItemService/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/18CustomItemService/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/18CustomItemService/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/18CustomItemService/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/18CustomItemService/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/18CustomItemService/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/18CustomItemService/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/18CustomItemService/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/18CustomItemService/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/18CustomItemService/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/18CustomItemService/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/18CustomItemService/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/18CustomItemService/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/18CustomItemService/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/18CustomItemService/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/18CustomItemService/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/18CustomItemService/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/18CustomItemService/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/18CustomItemService/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/18CustomItemService/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/18CustomItemService/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/18CustomItemService/types/servers/HttpServer.d.ts b/TypeScript/18CustomItemService/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/18CustomItemService/types/servers/HttpServer.d.ts +++ b/TypeScript/18CustomItemService/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/18CustomItemService/types/servers/SaveServer.d.ts b/TypeScript/18CustomItemService/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/18CustomItemService/types/servers/SaveServer.d.ts +++ b/TypeScript/18CustomItemService/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/18CustomItemService/types/servers/WebSocketServer.d.ts b/TypeScript/18CustomItemService/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/18CustomItemService/types/servers/WebSocketServer.d.ts +++ b/TypeScript/18CustomItemService/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/18CustomItemService/types/services/BotEquipmentFilterService.d.ts b/TypeScript/18CustomItemService/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/18CustomItemService/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/18CustomItemService/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts b/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts b/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/18CustomItemService/types/services/FenceService.d.ts b/TypeScript/18CustomItemService/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/18CustomItemService/types/services/FenceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts b/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts b/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts b/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/18CustomItemService/types/services/LocaleService.d.ts b/TypeScript/18CustomItemService/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/18CustomItemService/types/services/LocaleService.d.ts +++ b/TypeScript/18CustomItemService/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts b/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts +++ b/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/18CustomItemService/types/services/MatchLocationService.d.ts b/TypeScript/18CustomItemService/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/18CustomItemService/types/services/MatchLocationService.d.ts +++ b/TypeScript/18CustomItemService/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts b/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts +++ b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/18CustomItemService/types/services/PmcChatResponseService.d.ts b/TypeScript/18CustomItemService/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/18CustomItemService/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/18CustomItemService/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts b/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/18CustomItemService/types/services/RagfairOfferService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairOfferService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/18CustomItemService/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/18CustomItemService/types/services/RagfairTaxService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairTaxService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/18CustomItemService/types/services/RepairService.d.ts b/TypeScript/18CustomItemService/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/18CustomItemService/types/services/RepairService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/18CustomItemService/types/services/SeasonalEventService.d.ts b/TypeScript/18CustomItemService/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/18CustomItemService/types/services/SeasonalEventService.d.ts +++ b/TypeScript/18CustomItemService/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/18CustomItemService/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/18CustomItemService/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/18CustomItemService/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/18CustomItemService/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts b/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/18CustomItemService/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/18CustomItemService/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/18CustomItemService/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/18CustomItemService/types/services/cache/ModHashCacheService.d.ts b/TypeScript/18CustomItemService/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/18CustomItemService/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/18CustomItemService/types/services/mod/CustomItemService.d.ts b/TypeScript/18CustomItemService/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/18CustomItemService/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/18CustomItemService/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/18CustomItemService/types/utils/HashUtil.d.ts b/TypeScript/18CustomItemService/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/18CustomItemService/types/utils/HashUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/18CustomItemService/types/utils/HttpFileUtil.d.ts b/TypeScript/18CustomItemService/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/18CustomItemService/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/18CustomItemService/types/utils/HttpResponseUtil.d.ts b/TypeScript/18CustomItemService/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/18CustomItemService/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts b/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts b/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/18CustomItemService/types/utils/TimeUtil.d.ts b/TypeScript/18CustomItemService/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/18CustomItemService/types/utils/TimeUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/18CustomItemService/types/utils/UUidGenerator.d.ts b/TypeScript/18CustomItemService/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/18CustomItemService/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/18CustomItemService/types/utils/VFS.d.ts b/TypeScript/18CustomItemService/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/18CustomItemService/types/utils/VFS.d.ts +++ b/TypeScript/18CustomItemService/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/18CustomItemService/types/utils/Watermark.d.ts b/TypeScript/18CustomItemService/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/18CustomItemService/types/utils/Watermark.d.ts +++ b/TypeScript/18CustomItemService/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/18CustomItemService/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/18CustomItemService/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/18CustomItemService/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/18CustomItemService/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/18CustomItemService/types/utils/collections/lists/Nodes.d.ts b/TypeScript/18CustomItemService/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/18CustomItemService/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/18CustomItemService/types/utils/collections/queue/Queue.d.ts b/TypeScript/18CustomItemService/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/18CustomItemService/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/18CustomItemService/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/18CustomItemService/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/18CustomItemService/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/18CustomItemService/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/18CustomItemService/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/18CustomItemService/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/18CustomItemService/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/18CustomItemService/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/18CustomItemService/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/18CustomItemService/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/18CustomItemService/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/18CustomItemService/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/18CustomItemService/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/19UseExternalLibraries/package.json b/TypeScript/19UseExternalLibraries/package.json index 324bbe7..1c4338c 100644 --- a/TypeScript/19UseExternalLibraries/package.json +++ b/TypeScript/19UseExternalLibraries/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "TheSparta", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -18,16 +18,16 @@ "ora-classic": "5.4.2" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/19UseExternalLibraries/types/ErrorHandler.d.ts b/TypeScript/19UseExternalLibraries/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/19UseExternalLibraries/types/ErrorHandler.d.ts +++ b/TypeScript/19UseExternalLibraries/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/19UseExternalLibraries/types/Program.d.ts b/TypeScript/19UseExternalLibraries/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/19UseExternalLibraries/types/Program.d.ts +++ b/TypeScript/19UseExternalLibraries/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/BundleCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/GameCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/InraidCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/MatchCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/19UseExternalLibraries/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/TraderCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/19UseExternalLibraries/types/context/ApplicationContext.d.ts b/TypeScript/19UseExternalLibraries/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/19UseExternalLibraries/types/context/ApplicationContext.d.ts +++ b/TypeScript/19UseExternalLibraries/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/19UseExternalLibraries/types/controllers/AchievementController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/19UseExternalLibraries/types/controllers/BotController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/BotController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/19UseExternalLibraries/types/controllers/BuildController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/19UseExternalLibraries/types/controllers/DialogueController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/DialogueController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InventoryController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InventoryController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/LauncherController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/LauncherController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/19UseExternalLibraries/types/controllers/LocationController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/LocationController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/19UseExternalLibraries/types/controllers/MatchController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/MatchController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/19UseExternalLibraries/types/controllers/PresetBuildController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/19UseExternalLibraries/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/19UseExternalLibraries/types/controllers/PresetController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/PresetController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/ProfileController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/ProfileController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/QuestController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/QuestController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/RagfairController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/RagfairController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/19UseExternalLibraries/types/controllers/RepairController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/RepairController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/19UseExternalLibraries/types/controllers/TradeController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/TradeController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/TraderController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/TraderController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/19UseExternalLibraries/types/di/Router.d.ts b/TypeScript/19UseExternalLibraries/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/19UseExternalLibraries/types/di/Router.d.ts +++ b/TypeScript/19UseExternalLibraries/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotInventoryGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotLevelGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/19UseExternalLibraries/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/19UseExternalLibraries/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/19UseExternalLibraries/types/generators/LocationGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/LocationGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/LootGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/LootGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/19UseExternalLibraries/types/generators/PMCLootGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/PlayerScavGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/19UseExternalLibraries/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/19UseExternalLibraries/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/19UseExternalLibraries/types/generators/WeatherGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/19UseExternalLibraries/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/19UseExternalLibraries/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/19UseExternalLibraries/types/helpers/AssortHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/AssortHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ContainerHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/19UseExternalLibraries/types/helpers/DialogueHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/19UseExternalLibraries/types/helpers/HandbookHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/19UseExternalLibraries/types/helpers/InventoryHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/19UseExternalLibraries/types/helpers/PresetHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/PresetHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/QuestConditionHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/QuestHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/QuestHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/19UseExternalLibraries/types/helpers/RagfairServerHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/19UseExternalLibraries/types/helpers/TraderAssortHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/19UseExternalLibraries/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/19UseExternalLibraries/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts b/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/19UseExternalLibraries/types/loaders/PostAkiModLoader.d.ts b/TypeScript/19UseExternalLibraries/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/19UseExternalLibraries/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/19UseExternalLibraries/types/loaders/PostDBModLoader.d.ts b/TypeScript/19UseExternalLibraries/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/19UseExternalLibraries/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/19UseExternalLibraries/types/loaders/PreAkiModLoader.d.ts b/TypeScript/19UseExternalLibraries/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/19UseExternalLibraries/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/IGlobals.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocation.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocationBase.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/IPmcData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IItem.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IQteData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/BaseClasses.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/BonusSkillType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/BonusType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/ConfigTypes.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/ELocationName.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/ELocationName.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/ItemEventActions.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/MessageType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/MessageType.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/ModSpawn.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/SeasonalEventType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/TraderServiceType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/Traders.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/Traders.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/19UseExternalLibraries/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/19UseExternalLibraries/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotDurability.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/server/ILocations.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/19UseExternalLibraries/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/19UseExternalLibraries/types/routers/ItemEventRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/19UseExternalLibraries/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/19UseExternalLibraries/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/19UseExternalLibraries/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/19UseExternalLibraries/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/19UseExternalLibraries/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/19UseExternalLibraries/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/19UseExternalLibraries/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/19UseExternalLibraries/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/19UseExternalLibraries/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/19UseExternalLibraries/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/19UseExternalLibraries/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/19UseExternalLibraries/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/19UseExternalLibraries/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/19UseExternalLibraries/types/servers/HttpServer.d.ts b/TypeScript/19UseExternalLibraries/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/19UseExternalLibraries/types/servers/HttpServer.d.ts +++ b/TypeScript/19UseExternalLibraries/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/19UseExternalLibraries/types/servers/SaveServer.d.ts b/TypeScript/19UseExternalLibraries/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/19UseExternalLibraries/types/servers/SaveServer.d.ts +++ b/TypeScript/19UseExternalLibraries/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/19UseExternalLibraries/types/servers/WebSocketServer.d.ts b/TypeScript/19UseExternalLibraries/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/19UseExternalLibraries/types/servers/WebSocketServer.d.ts +++ b/TypeScript/19UseExternalLibraries/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/19UseExternalLibraries/types/services/BotEquipmentFilterService.d.ts b/TypeScript/19UseExternalLibraries/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/19UseExternalLibraries/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/BotGenerationCacheService.d.ts b/TypeScript/19UseExternalLibraries/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/19UseExternalLibraries/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/19UseExternalLibraries/types/services/BotLootCacheService.d.ts b/TypeScript/19UseExternalLibraries/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/19UseExternalLibraries/types/services/BotLootCacheService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts b/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/HashCacheService.d.ts b/TypeScript/19UseExternalLibraries/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/19UseExternalLibraries/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/19UseExternalLibraries/types/services/InsuranceService.d.ts b/TypeScript/19UseExternalLibraries/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/19UseExternalLibraries/types/services/InsuranceService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts b/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/19UseExternalLibraries/types/services/LocaleService.d.ts b/TypeScript/19UseExternalLibraries/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/19UseExternalLibraries/types/services/LocaleService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/19UseExternalLibraries/types/services/LocalisationService.d.ts b/TypeScript/19UseExternalLibraries/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/19UseExternalLibraries/types/services/LocalisationService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/19UseExternalLibraries/types/services/MatchLocationService.d.ts b/TypeScript/19UseExternalLibraries/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/19UseExternalLibraries/types/services/MatchLocationService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/ModCompilerService.d.ts b/TypeScript/19UseExternalLibraries/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/19UseExternalLibraries/types/services/ModCompilerService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/19UseExternalLibraries/types/services/PaymentService.d.ts b/TypeScript/19UseExternalLibraries/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/19UseExternalLibraries/types/services/PaymentService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/19UseExternalLibraries/types/services/PmcChatResponseService.d.ts b/TypeScript/19UseExternalLibraries/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/19UseExternalLibraries/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/19UseExternalLibraries/types/services/ProfileFixerService.d.ts b/TypeScript/19UseExternalLibraries/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/19UseExternalLibraries/types/services/ProfileFixerService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/RagfairOfferService.d.ts b/TypeScript/19UseExternalLibraries/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/19UseExternalLibraries/types/services/RagfairOfferService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/RagfairPriceService.d.ts b/TypeScript/19UseExternalLibraries/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/19UseExternalLibraries/types/services/RagfairPriceService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/19UseExternalLibraries/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/19UseExternalLibraries/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/19UseExternalLibraries/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/RagfairTaxService.d.ts b/TypeScript/19UseExternalLibraries/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/19UseExternalLibraries/types/services/RagfairTaxService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/19UseExternalLibraries/types/services/RepairService.d.ts b/TypeScript/19UseExternalLibraries/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/19UseExternalLibraries/types/services/RepairService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/19UseExternalLibraries/types/services/SeasonalEventService.d.ts b/TypeScript/19UseExternalLibraries/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/19UseExternalLibraries/types/services/SeasonalEventService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/19UseExternalLibraries/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/19UseExternalLibraries/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/19UseExternalLibraries/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts b/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/19UseExternalLibraries/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/19UseExternalLibraries/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/19UseExternalLibraries/types/services/cache/ModHashCacheService.d.ts b/TypeScript/19UseExternalLibraries/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/19UseExternalLibraries/types/services/mod/CustomItemService.d.ts b/TypeScript/19UseExternalLibraries/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/19UseExternalLibraries/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/19UseExternalLibraries/types/utils/HashUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/HashUtil.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/19UseExternalLibraries/types/utils/HttpFileUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/HttpResponseUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts b/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/19UseExternalLibraries/types/utils/RandomUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/RandomUtil.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/TimeUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/TimeUtil.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/UUidGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/19UseExternalLibraries/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/19UseExternalLibraries/types/utils/VFS.d.ts b/TypeScript/19UseExternalLibraries/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/VFS.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/19UseExternalLibraries/types/utils/Watermark.d.ts b/TypeScript/19UseExternalLibraries/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/Watermark.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/19UseExternalLibraries/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/collections/lists/Nodes.d.ts b/TypeScript/19UseExternalLibraries/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/19UseExternalLibraries/types/utils/collections/queue/Queue.d.ts b/TypeScript/19UseExternalLibraries/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/19UseExternalLibraries/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/1LogToConsole/package.json b/TypeScript/1LogToConsole/package.json index 9dd85db..dd2d874 100644 --- a/TypeScript/1LogToConsole/package.json +++ b/TypeScript/1LogToConsole/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -16,16 +16,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/1LogToConsole/types/ErrorHandler.d.ts b/TypeScript/1LogToConsole/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/1LogToConsole/types/ErrorHandler.d.ts +++ b/TypeScript/1LogToConsole/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/1LogToConsole/types/Program.d.ts b/TypeScript/1LogToConsole/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/1LogToConsole/types/Program.d.ts +++ b/TypeScript/1LogToConsole/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/1LogToConsole/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/1LogToConsole/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/1LogToConsole/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/1LogToConsole/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/1LogToConsole/types/callbacks/InraidCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/1LogToConsole/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/1LogToConsole/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/1LogToConsole/types/callbacks/MatchCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/1LogToConsole/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/1LogToConsole/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/1LogToConsole/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/1LogToConsole/types/context/ApplicationContext.d.ts b/TypeScript/1LogToConsole/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/1LogToConsole/types/context/ApplicationContext.d.ts +++ b/TypeScript/1LogToConsole/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/1LogToConsole/types/controllers/AchievementController.d.ts b/TypeScript/1LogToConsole/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/1LogToConsole/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/1LogToConsole/types/controllers/BuildController.d.ts b/TypeScript/1LogToConsole/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/1LogToConsole/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts b/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts b/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/1LogToConsole/types/controllers/PresetBuildController.d.ts b/TypeScript/1LogToConsole/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/1LogToConsole/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/1LogToConsole/types/controllers/PresetController.d.ts b/TypeScript/1LogToConsole/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/1LogToConsole/types/controllers/PresetController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/ProfileController.d.ts b/TypeScript/1LogToConsole/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/1LogToConsole/types/controllers/ProfileController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts b/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/1LogToConsole/types/di/Router.d.ts b/TypeScript/1LogToConsole/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/1LogToConsole/types/di/Router.d.ts +++ b/TypeScript/1LogToConsole/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/1LogToConsole/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/1LogToConsole/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/1LogToConsole/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/1LogToConsole/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/1LogToConsole/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/1LogToConsole/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/1LogToConsole/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/1LogToConsole/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/1LogToConsole/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/1LogToConsole/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/1LogToConsole/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/1LogToConsole/types/helpers/PresetHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/1LogToConsole/types/helpers/PresetHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/1LogToConsole/types/helpers/QuestConditionHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/1LogToConsole/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/1LogToConsole/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/1LogToConsole/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/1LogToConsole/types/loaders/PostAkiModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/1LogToConsole/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/1LogToConsole/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/1LogToConsole/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/ILocation.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/IPmcData.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IItem.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/1LogToConsole/types/models/eft/hideout/IQteData.d.ts b/TypeScript/1LogToConsole/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/1LogToConsole/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/1LogToConsole/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/1LogToConsole/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/1LogToConsole/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/1LogToConsole/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/1LogToConsole/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/1LogToConsole/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/1LogToConsole/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/1LogToConsole/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/1LogToConsole/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/1LogToConsole/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/1LogToConsole/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/1LogToConsole/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/1LogToConsole/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/1LogToConsole/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/1LogToConsole/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/1LogToConsole/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/1LogToConsole/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/1LogToConsole/types/models/enums/BonusSkillType.d.ts b/TypeScript/1LogToConsole/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/BonusType.d.ts b/TypeScript/1LogToConsole/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/1LogToConsole/types/models/enums/ELocationName.d.ts b/TypeScript/1LogToConsole/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ELocationName.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/1LogToConsole/types/models/enums/ItemEventActions.d.ts b/TypeScript/1LogToConsole/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/1LogToConsole/types/models/enums/MessageType.d.ts b/TypeScript/1LogToConsole/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/1LogToConsole/types/models/enums/MessageType.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/1LogToConsole/types/models/enums/ModSpawn.d.ts b/TypeScript/1LogToConsole/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/1LogToConsole/types/models/enums/SeasonalEventType.d.ts b/TypeScript/1LogToConsole/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/1LogToConsole/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/1LogToConsole/types/models/enums/TraderServiceType.d.ts b/TypeScript/1LogToConsole/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/Traders.d.ts b/TypeScript/1LogToConsole/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/1LogToConsole/types/models/enums/Traders.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/QteType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/1LogToConsole/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/1LogToConsole/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/1LogToConsole/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/1LogToConsole/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/1LogToConsole/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/1LogToConsole/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotDurability.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/1LogToConsole/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/1LogToConsole/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/1LogToConsole/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/1LogToConsole/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/1LogToConsole/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/1LogToConsole/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/1LogToConsole/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/1LogToConsole/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/1LogToConsole/types/models/spt/server/ILocations.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/1LogToConsole/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/1LogToConsole/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/1LogToConsole/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/1LogToConsole/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/1LogToConsole/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts b/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/1LogToConsole/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/1LogToConsole/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/1LogToConsole/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/1LogToConsole/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/1LogToConsole/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/1LogToConsole/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/1LogToConsole/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/1LogToConsole/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/1LogToConsole/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/1LogToConsole/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/1LogToConsole/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/1LogToConsole/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/1LogToConsole/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/1LogToConsole/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/1LogToConsole/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/1LogToConsole/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/1LogToConsole/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/1LogToConsole/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts b/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/1LogToConsole/types/servers/SaveServer.d.ts b/TypeScript/1LogToConsole/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/1LogToConsole/types/servers/SaveServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/1LogToConsole/types/servers/WebSocketServer.d.ts b/TypeScript/1LogToConsole/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/1LogToConsole/types/servers/WebSocketServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts b/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/1LogToConsole/types/services/LocaleService.d.ts b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/1LogToConsole/types/services/LocaleService.d.ts +++ b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts b/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts +++ b/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/1LogToConsole/types/services/MatchLocationService.d.ts b/TypeScript/1LogToConsole/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/1LogToConsole/types/services/MatchLocationService.d.ts +++ b/TypeScript/1LogToConsole/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts b/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairTaxService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairTaxService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/1LogToConsole/types/services/RepairService.d.ts b/TypeScript/1LogToConsole/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/1LogToConsole/types/services/RepairService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts +++ b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts b/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/1LogToConsole/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/1LogToConsole/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/1LogToConsole/types/services/cache/ModHashCacheService.d.ts b/TypeScript/1LogToConsole/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/1LogToConsole/types/services/mod/CustomItemService.d.ts b/TypeScript/1LogToConsole/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/1LogToConsole/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/1LogToConsole/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/1LogToConsole/types/utils/HashUtil.d.ts b/TypeScript/1LogToConsole/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/1LogToConsole/types/utils/HashUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts b/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/1LogToConsole/types/utils/HttpResponseUtil.d.ts b/TypeScript/1LogToConsole/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/1LogToConsole/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/1LogToConsole/types/utils/UUidGenerator.d.ts b/TypeScript/1LogToConsole/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/1LogToConsole/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/1LogToConsole/types/utils/VFS.d.ts b/TypeScript/1LogToConsole/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/1LogToConsole/types/utils/VFS.d.ts +++ b/TypeScript/1LogToConsole/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/1LogToConsole/types/utils/Watermark.d.ts b/TypeScript/1LogToConsole/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/1LogToConsole/types/utils/Watermark.d.ts +++ b/TypeScript/1LogToConsole/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/1LogToConsole/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/1LogToConsole/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/1LogToConsole/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/1LogToConsole/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/1LogToConsole/types/utils/collections/lists/Nodes.d.ts b/TypeScript/1LogToConsole/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/1LogToConsole/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/1LogToConsole/types/utils/collections/queue/Queue.d.ts b/TypeScript/1LogToConsole/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/1LogToConsole/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/1LogToConsole/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/1LogToConsole/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/1LogToConsole/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/1LogToConsole/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/1LogToConsole/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/1LogToConsole/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/1LogToConsole/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/1LogToConsole/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/1LogToConsole/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/1LogToConsole/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/1LogToConsole/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/1LogToConsole/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/1LogToConsole/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/20CustomChatBot/package.json b/TypeScript/20CustomChatBot/package.json index 5147864..99c6426 100644 --- a/TypeScript/20CustomChatBot/package.json +++ b/TypeScript/20CustomChatBot/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "clodan", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/20CustomChatBot/types/ErrorHandler.d.ts b/TypeScript/20CustomChatBot/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/20CustomChatBot/types/ErrorHandler.d.ts +++ b/TypeScript/20CustomChatBot/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/20CustomChatBot/types/Program.d.ts b/TypeScript/20CustomChatBot/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/20CustomChatBot/types/Program.d.ts +++ b/TypeScript/20CustomChatBot/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/20CustomChatBot/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/20CustomChatBot/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/20CustomChatBot/types/callbacks/BundleCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/20CustomChatBot/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/GameCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/20CustomChatBot/types/callbacks/InraidCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/MatchCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/20CustomChatBot/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/20CustomChatBot/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/20CustomChatBot/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/20CustomChatBot/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/20CustomChatBot/types/callbacks/TraderCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/20CustomChatBot/types/context/ApplicationContext.d.ts b/TypeScript/20CustomChatBot/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/20CustomChatBot/types/context/ApplicationContext.d.ts +++ b/TypeScript/20CustomChatBot/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/20CustomChatBot/types/controllers/AchievementController.d.ts b/TypeScript/20CustomChatBot/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/20CustomChatBot/types/controllers/BotController.d.ts b/TypeScript/20CustomChatBot/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/20CustomChatBot/types/controllers/BotController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/20CustomChatBot/types/controllers/BuildController.d.ts b/TypeScript/20CustomChatBot/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/20CustomChatBot/types/controllers/DialogueController.d.ts b/TypeScript/20CustomChatBot/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/20CustomChatBot/types/controllers/DialogueController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts b/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts b/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts b/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/20CustomChatBot/types/controllers/InsuranceController.d.ts b/TypeScript/20CustomChatBot/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/20CustomChatBot/types/controllers/InsuranceController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/20CustomChatBot/types/controllers/InventoryController.d.ts b/TypeScript/20CustomChatBot/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/20CustomChatBot/types/controllers/InventoryController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/20CustomChatBot/types/controllers/LauncherController.d.ts b/TypeScript/20CustomChatBot/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/20CustomChatBot/types/controllers/LauncherController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/20CustomChatBot/types/controllers/LocationController.d.ts b/TypeScript/20CustomChatBot/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/20CustomChatBot/types/controllers/LocationController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/20CustomChatBot/types/controllers/MatchController.d.ts b/TypeScript/20CustomChatBot/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/20CustomChatBot/types/controllers/MatchController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/20CustomChatBot/types/controllers/PresetBuildController.d.ts b/TypeScript/20CustomChatBot/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/20CustomChatBot/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/20CustomChatBot/types/controllers/PresetController.d.ts b/TypeScript/20CustomChatBot/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/20CustomChatBot/types/controllers/PresetController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/20CustomChatBot/types/controllers/ProfileController.d.ts b/TypeScript/20CustomChatBot/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/20CustomChatBot/types/controllers/ProfileController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/20CustomChatBot/types/controllers/QuestController.d.ts b/TypeScript/20CustomChatBot/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/20CustomChatBot/types/controllers/QuestController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/controllers/RagfairController.d.ts b/TypeScript/20CustomChatBot/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/20CustomChatBot/types/controllers/RagfairController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/20CustomChatBot/types/controllers/RepairController.d.ts b/TypeScript/20CustomChatBot/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/20CustomChatBot/types/controllers/RepairController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/20CustomChatBot/types/controllers/RepeatableQuestController.d.ts b/TypeScript/20CustomChatBot/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/20CustomChatBot/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/20CustomChatBot/types/controllers/TradeController.d.ts b/TypeScript/20CustomChatBot/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/20CustomChatBot/types/controllers/TradeController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/controllers/TraderController.d.ts b/TypeScript/20CustomChatBot/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/20CustomChatBot/types/controllers/TraderController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/20CustomChatBot/types/di/Router.d.ts b/TypeScript/20CustomChatBot/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/20CustomChatBot/types/di/Router.d.ts +++ b/TypeScript/20CustomChatBot/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/20CustomChatBot/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/20CustomChatBot/types/generators/BotInventoryGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/20CustomChatBot/types/generators/BotLevelGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/20CustomChatBot/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/20CustomChatBot/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/20CustomChatBot/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/20CustomChatBot/types/generators/LocationGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/20CustomChatBot/types/generators/LocationGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/20CustomChatBot/types/generators/LootGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/20CustomChatBot/types/generators/LootGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/20CustomChatBot/types/generators/PMCLootGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/20CustomChatBot/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/20CustomChatBot/types/generators/PlayerScavGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/20CustomChatBot/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/20CustomChatBot/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/20CustomChatBot/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/20CustomChatBot/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/20CustomChatBot/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/20CustomChatBot/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/20CustomChatBot/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/20CustomChatBot/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/20CustomChatBot/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/20CustomChatBot/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/20CustomChatBot/types/generators/WeatherGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/20CustomChatBot/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/20CustomChatBot/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/20CustomChatBot/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/20CustomChatBot/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/20CustomChatBot/types/helpers/AssortHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/20CustomChatBot/types/helpers/AssortHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/20CustomChatBot/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/20CustomChatBot/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/20CustomChatBot/types/helpers/ContainerHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/20CustomChatBot/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts deleted file mode 100644 index 8034dc1..0000000 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IChatCommand, ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; -import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -export declare abstract class AbstractDialogueChatBot implements IDialogueChatBot { - protected logger: ILogger; - protected mailSendService: MailSendService; - protected chatCommands: IChatCommand[] | ICommandoCommand[]; - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[] | ICommandoCommand[]); - /** - * @deprecated use registerChatCommand instead - */ - registerCommandoCommand(chatCommand: IChatCommand | ICommandoCommand): void; - registerChatCommand(chatCommand: IChatCommand | ICommandoCommand): void; - abstract getChatBot(): IUserDialogInfo; - protected abstract getUnrecognizedCommandMessage(): string; - handleMessage(sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/IChatCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts similarity index 75% rename from TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/IChatCommand.d.ts rename to TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts index 247aea7..cca1fb3 100644 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/IChatCommand.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts @@ -1,10 +1,6 @@ import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -/** - * @deprecated Use IChatCommand instead - */ -export type ICommandoCommand = IChatCommand; -export interface IChatCommand { +export interface ICommandoCommand { getCommandPrefix(): string; getCommandHelp(command: string): string; getCommands(): Set; diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts index 8626984..62fb63e 100644 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts @@ -1,9 +1,9 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -export declare class SptCommandoCommands implements IChatCommand { +export declare class SptCommandoCommands implements ICommandoCommand { protected configServer: ConfigServer; protected sptCommands: ISptCommand[]; constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts index e7925bb..33d05de 100644 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts @@ -7,9 +7,6 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; export declare class GiveSptCommand implements ISptCommand { protected logger: ILogger; protected itemHelper: ItemHelper; @@ -17,20 +14,7 @@ export declare class GiveSptCommand implements ISptCommand { protected jsonUtil: JsonUtil; protected presetHelper: PresetHelper; protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isnt sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts deleted file mode 100644 index 5f8d3a1..0000000 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare class SavedCommand { - quantity: number; - potentialItemNames: string[]; - locale: string; - constructor(quantity: number, potentialItemNames: string[], locale: string); -} diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts index 391969f..e1213a2 100644 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts @@ -1,10 +1,15 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; -import { AbstractDialogueChatBot } from "@spt-aki/helpers/Dialogue/AbstractDialogueChatBot"; -export declare class CommandoDialogueChatBot extends AbstractDialogueChatBot { - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[]); +export declare class CommandoDialogueChatBot implements IDialogueChatBot { + protected logger: ILogger; + protected mailSendService: MailSendService; + protected commandoCommands: ICommandoCommand[]; + constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]); + registerCommandoCommand(commandoCommand: ICommandoCommand): void; getChatBot(): IUserDialogInfo; - protected getUnrecognizedCommandMessage(): string; + handleMessage(sessionId: string, request: ISendMessageRequest): string; } diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/20CustomChatBot/types/helpers/DialogueHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/20CustomChatBot/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/20CustomChatBot/types/helpers/HandbookHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/20CustomChatBot/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/20CustomChatBot/types/helpers/InRaidHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/20CustomChatBot/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/20CustomChatBot/types/helpers/InventoryHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/20CustomChatBot/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/20CustomChatBot/types/helpers/PresetHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/20CustomChatBot/types/helpers/PresetHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/20CustomChatBot/types/helpers/QuestConditionHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/20CustomChatBot/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/20CustomChatBot/types/helpers/QuestHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/20CustomChatBot/types/helpers/QuestHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/20CustomChatBot/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/20CustomChatBot/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/20CustomChatBot/types/helpers/RagfairServerHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/20CustomChatBot/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/20CustomChatBot/types/helpers/TraderAssortHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/20CustomChatBot/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/20CustomChatBot/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/20CustomChatBot/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/20CustomChatBot/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts b/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts +++ b/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/20CustomChatBot/types/loaders/PostAkiModLoader.d.ts b/TypeScript/20CustomChatBot/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/20CustomChatBot/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/20CustomChatBot/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/20CustomChatBot/types/loaders/PostDBModLoader.d.ts b/TypeScript/20CustomChatBot/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/20CustomChatBot/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/20CustomChatBot/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/20CustomChatBot/types/loaders/PreAkiModLoader.d.ts b/TypeScript/20CustomChatBot/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/20CustomChatBot/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/20CustomChatBot/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/20CustomChatBot/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/IGlobals.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/ILocation.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/ILocationBase.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/IPmcData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IItem.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/20CustomChatBot/types/models/eft/hideout/IQteData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/20CustomChatBot/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/20CustomChatBot/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/20CustomChatBot/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/20CustomChatBot/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/20CustomChatBot/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/20CustomChatBot/types/models/enums/BaseClasses.d.ts b/TypeScript/20CustomChatBot/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/20CustomChatBot/types/models/enums/BonusSkillType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/BonusType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/ConfigTypes.d.ts b/TypeScript/20CustomChatBot/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/20CustomChatBot/types/models/enums/ELocationName.d.ts b/TypeScript/20CustomChatBot/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/ELocationName.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/20CustomChatBot/types/models/enums/ItemEventActions.d.ts b/TypeScript/20CustomChatBot/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/20CustomChatBot/types/models/enums/MessageType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/MessageType.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/20CustomChatBot/types/models/enums/ModSpawn.d.ts b/TypeScript/20CustomChatBot/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/SeasonalEventType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/20CustomChatBot/types/models/enums/TraderServiceType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/Traders.d.ts b/TypeScript/20CustomChatBot/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/Traders.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/20CustomChatBot/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/20CustomChatBot/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/20CustomChatBot/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/20CustomChatBot/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/QteType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/20CustomChatBot/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/20CustomChatBot/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/20CustomChatBot/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/20CustomChatBot/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/20CustomChatBot/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/20CustomChatBot/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/20CustomChatBot/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/20CustomChatBot/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IBotConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IBotDurability.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IItemConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/20CustomChatBot/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/20CustomChatBot/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/20CustomChatBot/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/20CustomChatBot/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/20CustomChatBot/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/20CustomChatBot/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/20CustomChatBot/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/20CustomChatBot/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/20CustomChatBot/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/20CustomChatBot/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/20CustomChatBot/types/models/spt/server/ILocations.d.ts b/TypeScript/20CustomChatBot/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/20CustomChatBot/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/20CustomChatBot/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/20CustomChatBot/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/20CustomChatBot/types/models/spt/services/LootRequest.d.ts b/TypeScript/20CustomChatBot/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/20CustomChatBot/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/20CustomChatBot/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/20CustomChatBot/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/20CustomChatBot/types/routers/ItemEventRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/20CustomChatBot/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/20CustomChatBot/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/20CustomChatBot/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/20CustomChatBot/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/20CustomChatBot/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/20CustomChatBot/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/20CustomChatBot/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/20CustomChatBot/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/20CustomChatBot/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/20CustomChatBot/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/20CustomChatBot/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/20CustomChatBot/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/20CustomChatBot/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/20CustomChatBot/types/servers/HttpServer.d.ts b/TypeScript/20CustomChatBot/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/20CustomChatBot/types/servers/HttpServer.d.ts +++ b/TypeScript/20CustomChatBot/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/20CustomChatBot/types/servers/SaveServer.d.ts b/TypeScript/20CustomChatBot/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/20CustomChatBot/types/servers/SaveServer.d.ts +++ b/TypeScript/20CustomChatBot/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/20CustomChatBot/types/servers/WebSocketServer.d.ts b/TypeScript/20CustomChatBot/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/20CustomChatBot/types/servers/WebSocketServer.d.ts +++ b/TypeScript/20CustomChatBot/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/20CustomChatBot/types/services/BotEquipmentFilterService.d.ts b/TypeScript/20CustomChatBot/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/20CustomChatBot/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/20CustomChatBot/types/services/BotGenerationCacheService.d.ts b/TypeScript/20CustomChatBot/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/20CustomChatBot/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/20CustomChatBot/types/services/BotLootCacheService.d.ts b/TypeScript/20CustomChatBot/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/20CustomChatBot/types/services/BotLootCacheService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/20CustomChatBot/types/services/FenceService.d.ts b/TypeScript/20CustomChatBot/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/20CustomChatBot/types/services/FenceService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/20CustomChatBot/types/services/HashCacheService.d.ts b/TypeScript/20CustomChatBot/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/20CustomChatBot/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/20CustomChatBot/types/services/InsuranceService.d.ts b/TypeScript/20CustomChatBot/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/20CustomChatBot/types/services/InsuranceService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/20CustomChatBot/types/services/ItemFilterService.d.ts b/TypeScript/20CustomChatBot/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/20CustomChatBot/types/services/ItemFilterService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/20CustomChatBot/types/services/LocaleService.d.ts b/TypeScript/20CustomChatBot/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/20CustomChatBot/types/services/LocaleService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/20CustomChatBot/types/services/LocalisationService.d.ts b/TypeScript/20CustomChatBot/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/20CustomChatBot/types/services/LocalisationService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/20CustomChatBot/types/services/MatchLocationService.d.ts b/TypeScript/20CustomChatBot/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/20CustomChatBot/types/services/MatchLocationService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/20CustomChatBot/types/services/ModCompilerService.d.ts b/TypeScript/20CustomChatBot/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/20CustomChatBot/types/services/ModCompilerService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/20CustomChatBot/types/services/PaymentService.d.ts b/TypeScript/20CustomChatBot/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/20CustomChatBot/types/services/PaymentService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/20CustomChatBot/types/services/PmcChatResponseService.d.ts b/TypeScript/20CustomChatBot/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/20CustomChatBot/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/20CustomChatBot/types/services/ProfileFixerService.d.ts b/TypeScript/20CustomChatBot/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/20CustomChatBot/types/services/ProfileFixerService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/20CustomChatBot/types/services/RagfairOfferService.d.ts b/TypeScript/20CustomChatBot/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/20CustomChatBot/types/services/RagfairOfferService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/20CustomChatBot/types/services/RagfairPriceService.d.ts b/TypeScript/20CustomChatBot/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/20CustomChatBot/types/services/RagfairPriceService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/20CustomChatBot/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/20CustomChatBot/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/20CustomChatBot/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/20CustomChatBot/types/services/RagfairTaxService.d.ts b/TypeScript/20CustomChatBot/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/20CustomChatBot/types/services/RagfairTaxService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/20CustomChatBot/types/services/RepairService.d.ts b/TypeScript/20CustomChatBot/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/20CustomChatBot/types/services/RepairService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/20CustomChatBot/types/services/SeasonalEventService.d.ts b/TypeScript/20CustomChatBot/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/20CustomChatBot/types/services/SeasonalEventService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/20CustomChatBot/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/20CustomChatBot/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/20CustomChatBot/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts b/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/20CustomChatBot/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/20CustomChatBot/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/20CustomChatBot/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/20CustomChatBot/types/services/cache/ModHashCacheService.d.ts b/TypeScript/20CustomChatBot/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/20CustomChatBot/types/services/mod/CustomItemService.d.ts b/TypeScript/20CustomChatBot/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/20CustomChatBot/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/20CustomChatBot/types/utils/HashUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/20CustomChatBot/types/utils/HashUtil.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/20CustomChatBot/types/utils/HttpFileUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/20CustomChatBot/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/20CustomChatBot/types/utils/HttpResponseUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/20CustomChatBot/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts b/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/20CustomChatBot/types/utils/RandomUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/20CustomChatBot/types/utils/RandomUtil.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/20CustomChatBot/types/utils/TimeUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/20CustomChatBot/types/utils/TimeUtil.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/20CustomChatBot/types/utils/UUidGenerator.d.ts b/TypeScript/20CustomChatBot/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/20CustomChatBot/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/20CustomChatBot/types/utils/VFS.d.ts b/TypeScript/20CustomChatBot/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/20CustomChatBot/types/utils/VFS.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/20CustomChatBot/types/utils/Watermark.d.ts b/TypeScript/20CustomChatBot/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/20CustomChatBot/types/utils/Watermark.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/20CustomChatBot/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/20CustomChatBot/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/20CustomChatBot/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/20CustomChatBot/types/utils/collections/lists/Nodes.d.ts b/TypeScript/20CustomChatBot/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/20CustomChatBot/types/utils/collections/queue/Queue.d.ts b/TypeScript/20CustomChatBot/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/20CustomChatBot/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/20CustomChatBot/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/20CustomChatBot/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/20CustomChatBot/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/20CustomChatBot/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/20CustomChatBot/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/20CustomChatBot/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/20CustomChatBot/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/20CustomChatBot/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/20CustomChatBot/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/21CustomCommandoCommand/package.json b/TypeScript/21CustomCommandoCommand/package.json index 600d882..efd1b48 100644 --- a/TypeScript/21CustomCommandoCommand/package.json +++ b/TypeScript/21CustomCommandoCommand/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "clodan", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/21CustomCommandoCommand/types/ErrorHandler.d.ts b/TypeScript/21CustomCommandoCommand/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/21CustomCommandoCommand/types/ErrorHandler.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/Program.d.ts b/TypeScript/21CustomCommandoCommand/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/21CustomCommandoCommand/types/Program.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/BundleCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/GameCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/InraidCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/MatchCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/TraderCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/21CustomCommandoCommand/types/context/ApplicationContext.d.ts b/TypeScript/21CustomCommandoCommand/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/21CustomCommandoCommand/types/context/ApplicationContext.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/AchievementController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/BotController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/BotController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/BuildController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/DialogueController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/DialogueController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/InsuranceController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/InsuranceController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/InventoryController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/InventoryController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/LauncherController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/LauncherController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/LocationController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/LocationController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/MatchController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/MatchController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/PresetBuildController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/21CustomCommandoCommand/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/PresetController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/PresetController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/ProfileController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/ProfileController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/QuestController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/QuestController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/RagfairController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/RagfairController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/RepairController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/RepairController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/RepeatableQuestController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/TradeController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/TradeController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/TraderController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/TraderController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/21CustomCommandoCommand/types/di/Router.d.ts b/TypeScript/21CustomCommandoCommand/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/21CustomCommandoCommand/types/di/Router.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotInventoryGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotLevelGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/21CustomCommandoCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/21CustomCommandoCommand/types/generators/LocationGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/LocationGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/LootGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/LootGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/21CustomCommandoCommand/types/generators/PMCLootGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/PlayerScavGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/21CustomCommandoCommand/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/21CustomCommandoCommand/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/21CustomCommandoCommand/types/generators/WeatherGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/21CustomCommandoCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/AssortHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/AssortHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/ContainerHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts deleted file mode 100644 index 8034dc1..0000000 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IChatCommand, ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; -import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -export declare abstract class AbstractDialogueChatBot implements IDialogueChatBot { - protected logger: ILogger; - protected mailSendService: MailSendService; - protected chatCommands: IChatCommand[] | ICommandoCommand[]; - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[] | ICommandoCommand[]); - /** - * @deprecated use registerChatCommand instead - */ - registerCommandoCommand(chatCommand: IChatCommand | ICommandoCommand): void; - registerChatCommand(chatCommand: IChatCommand | ICommandoCommand): void; - abstract getChatBot(): IUserDialogInfo; - protected abstract getUnrecognizedCommandMessage(): string; - handleMessage(sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts similarity index 75% rename from TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts rename to TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts index 247aea7..cca1fb3 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts @@ -1,10 +1,6 @@ import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -/** - * @deprecated Use IChatCommand instead - */ -export type ICommandoCommand = IChatCommand; -export interface IChatCommand { +export interface ICommandoCommand { getCommandPrefix(): string; getCommandHelp(command: string): string; getCommands(): Set; diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts index 8626984..62fb63e 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts @@ -1,9 +1,9 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -export declare class SptCommandoCommands implements IChatCommand { +export declare class SptCommandoCommands implements ICommandoCommand { protected configServer: ConfigServer; protected sptCommands: ISptCommand[]; constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts index e7925bb..33d05de 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts @@ -7,9 +7,6 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; export declare class GiveSptCommand implements ISptCommand { protected logger: ILogger; protected itemHelper: ItemHelper; @@ -17,20 +14,7 @@ export declare class GiveSptCommand implements ISptCommand { protected jsonUtil: JsonUtil; protected presetHelper: PresetHelper; protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isnt sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts deleted file mode 100644 index 5f8d3a1..0000000 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare class SavedCommand { - quantity: number; - potentialItemNames: string[]; - locale: string; - constructor(quantity: number, potentialItemNames: string[], locale: string); -} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts index 391969f..e1213a2 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts @@ -1,10 +1,15 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; -import { AbstractDialogueChatBot } from "@spt-aki/helpers/Dialogue/AbstractDialogueChatBot"; -export declare class CommandoDialogueChatBot extends AbstractDialogueChatBot { - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[]); +export declare class CommandoDialogueChatBot implements IDialogueChatBot { + protected logger: ILogger; + protected mailSendService: MailSendService; + protected commandoCommands: ICommandoCommand[]; + constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]); + registerCommandoCommand(commandoCommand: ICommandoCommand): void; getChatBot(): IUserDialogInfo; - protected getUnrecognizedCommandMessage(): string; + handleMessage(sessionId: string, request: ISendMessageRequest): string; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/DialogueHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/HandbookHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/InRaidHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/InventoryHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/PresetHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/PresetHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/QuestConditionHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/QuestHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/QuestHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/RagfairServerHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/TraderAssortHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/21CustomCommandoCommand/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/21CustomCommandoCommand/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts b/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/21CustomCommandoCommand/types/loaders/PostAkiModLoader.d.ts b/TypeScript/21CustomCommandoCommand/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/21CustomCommandoCommand/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/21CustomCommandoCommand/types/loaders/PostDBModLoader.d.ts b/TypeScript/21CustomCommandoCommand/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/21CustomCommandoCommand/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/loaders/PreAkiModLoader.d.ts b/TypeScript/21CustomCommandoCommand/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/21CustomCommandoCommand/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/IGlobals.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocation.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocationBase.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/IPmcData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IItem.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IQteData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/BaseClasses.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/BonusSkillType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/BonusType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/ConfigTypes.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/ELocationName.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/ELocationName.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/ItemEventActions.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/MessageType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/MessageType.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/ModSpawn.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/SeasonalEventType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/TraderServiceType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/Traders.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/Traders.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotDurability.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IItemConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/server/ILocations.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/services/LootRequest.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/21CustomCommandoCommand/types/routers/ItemEventRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/21CustomCommandoCommand/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/21CustomCommandoCommand/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/21CustomCommandoCommand/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/21CustomCommandoCommand/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/21CustomCommandoCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/21CustomCommandoCommand/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/21CustomCommandoCommand/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/21CustomCommandoCommand/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/21CustomCommandoCommand/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/21CustomCommandoCommand/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/21CustomCommandoCommand/types/servers/HttpServer.d.ts b/TypeScript/21CustomCommandoCommand/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/21CustomCommandoCommand/types/servers/HttpServer.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/21CustomCommandoCommand/types/servers/SaveServer.d.ts b/TypeScript/21CustomCommandoCommand/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/21CustomCommandoCommand/types/servers/SaveServer.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/21CustomCommandoCommand/types/servers/WebSocketServer.d.ts b/TypeScript/21CustomCommandoCommand/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/21CustomCommandoCommand/types/servers/WebSocketServer.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/21CustomCommandoCommand/types/services/BotEquipmentFilterService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/BotGenerationCacheService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/21CustomCommandoCommand/types/services/BotLootCacheService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/BotLootCacheService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/HashCacheService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/21CustomCommandoCommand/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/21CustomCommandoCommand/types/services/InsuranceService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/InsuranceService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/ItemFilterService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/ItemFilterService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/21CustomCommandoCommand/types/services/LocaleService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/LocaleService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/LocalisationService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/LocalisationService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/21CustomCommandoCommand/types/services/MatchLocationService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/MatchLocationService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/ModCompilerService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/ModCompilerService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/21CustomCommandoCommand/types/services/PaymentService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/PaymentService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/21CustomCommandoCommand/types/services/PmcChatResponseService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/21CustomCommandoCommand/types/services/ProfileFixerService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/ProfileFixerService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/RagfairOfferService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/RagfairOfferService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/RagfairPriceService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/RagfairPriceService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/21CustomCommandoCommand/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/RagfairTaxService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/RagfairTaxService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/RepairService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/RepairService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/SeasonalEventService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/SeasonalEventService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/21CustomCommandoCommand/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/21CustomCommandoCommand/types/services/cache/ModHashCacheService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/21CustomCommandoCommand/types/services/mod/CustomItemService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/21CustomCommandoCommand/types/utils/HashUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/HashUtil.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/21CustomCommandoCommand/types/utils/HttpFileUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/HttpResponseUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/21CustomCommandoCommand/types/utils/RandomUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/RandomUtil.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/TimeUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/TimeUtil.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/UUidGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/21CustomCommandoCommand/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/21CustomCommandoCommand/types/utils/VFS.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/VFS.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/21CustomCommandoCommand/types/utils/Watermark.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/Watermark.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/Nodes.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/21CustomCommandoCommand/types/utils/collections/queue/Queue.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/21CustomCommandoCommand/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/22CustomAkiCommand/package.json b/TypeScript/22CustomAkiCommand/package.json index 21f3f0d..69d940c 100644 --- a/TypeScript/22CustomAkiCommand/package.json +++ b/TypeScript/22CustomAkiCommand/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "clodan", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/22CustomAkiCommand/types/ErrorHandler.d.ts b/TypeScript/22CustomAkiCommand/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/22CustomAkiCommand/types/ErrorHandler.d.ts +++ b/TypeScript/22CustomAkiCommand/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/22CustomAkiCommand/types/Program.d.ts b/TypeScript/22CustomAkiCommand/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/22CustomAkiCommand/types/Program.d.ts +++ b/TypeScript/22CustomAkiCommand/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/BundleCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/GameCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/InraidCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/MatchCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/22CustomAkiCommand/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/TraderCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/22CustomAkiCommand/types/context/ApplicationContext.d.ts b/TypeScript/22CustomAkiCommand/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/22CustomAkiCommand/types/context/ApplicationContext.d.ts +++ b/TypeScript/22CustomAkiCommand/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/22CustomAkiCommand/types/controllers/AchievementController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/22CustomAkiCommand/types/controllers/BotController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/BotController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/22CustomAkiCommand/types/controllers/BuildController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/22CustomAkiCommand/types/controllers/DialogueController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/DialogueController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/InsuranceController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/InsuranceController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/22CustomAkiCommand/types/controllers/InventoryController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/InventoryController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/LauncherController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/LauncherController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/22CustomAkiCommand/types/controllers/LocationController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/LocationController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/22CustomAkiCommand/types/controllers/MatchController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/MatchController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/22CustomAkiCommand/types/controllers/PresetBuildController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/22CustomAkiCommand/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/22CustomAkiCommand/types/controllers/PresetController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/PresetController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/ProfileController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/ProfileController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/QuestController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/QuestController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/RagfairController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/RagfairController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/22CustomAkiCommand/types/controllers/RepairController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/RepairController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/22CustomAkiCommand/types/controllers/RepeatableQuestController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/22CustomAkiCommand/types/controllers/TradeController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/TradeController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/controllers/TraderController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/TraderController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/22CustomAkiCommand/types/di/Router.d.ts b/TypeScript/22CustomAkiCommand/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/22CustomAkiCommand/types/di/Router.d.ts +++ b/TypeScript/22CustomAkiCommand/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotInventoryGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotLevelGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/22CustomAkiCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/22CustomAkiCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/22CustomAkiCommand/types/generators/LocationGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/LocationGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/LootGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/LootGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/22CustomAkiCommand/types/generators/PMCLootGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/PlayerScavGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/22CustomAkiCommand/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/22CustomAkiCommand/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/22CustomAkiCommand/types/generators/WeatherGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/22CustomAkiCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/22CustomAkiCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/22CustomAkiCommand/types/helpers/AssortHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/AssortHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/ContainerHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts deleted file mode 100644 index 8034dc1..0000000 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/AbstractDialogueChatBot.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IChatCommand, ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; -import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -export declare abstract class AbstractDialogueChatBot implements IDialogueChatBot { - protected logger: ILogger; - protected mailSendService: MailSendService; - protected chatCommands: IChatCommand[] | ICommandoCommand[]; - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[] | ICommandoCommand[]); - /** - * @deprecated use registerChatCommand instead - */ - registerCommandoCommand(chatCommand: IChatCommand | ICommandoCommand): void; - registerChatCommand(chatCommand: IChatCommand | ICommandoCommand): void; - abstract getChatBot(): IUserDialogInfo; - protected abstract getUnrecognizedCommandMessage(): string; - handleMessage(sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts similarity index 75% rename from TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts rename to TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts index 247aea7..cca1fb3 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/IChatCommand.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts @@ -1,10 +1,6 @@ import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -/** - * @deprecated Use IChatCommand instead - */ -export type ICommandoCommand = IChatCommand; -export interface IChatCommand { +export interface ICommandoCommand { getCommandPrefix(): string; getCommandHelp(command: string): string; getCommands(): Set; diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts index 8626984..62fb63e 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts @@ -1,9 +1,9 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -export declare class SptCommandoCommands implements IChatCommand { +export declare class SptCommandoCommands implements ICommandoCommand { protected configServer: ConfigServer; protected sptCommands: ISptCommand[]; constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts index e7925bb..33d05de 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts @@ -7,9 +7,6 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; export declare class GiveSptCommand implements ISptCommand { protected logger: ILogger; protected itemHelper: ItemHelper; @@ -17,20 +14,7 @@ export declare class GiveSptCommand implements ISptCommand { protected jsonUtil: JsonUtil; protected presetHelper: PresetHelper; protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isnt sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts deleted file mode 100644 index 5f8d3a1..0000000 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare class SavedCommand { - quantity: number; - potentialItemNames: string[]; - locale: string; - constructor(quantity: number, potentialItemNames: string[], locale: string); -} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts index 391969f..e1213a2 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts @@ -1,10 +1,15 @@ -import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand"; +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { MailSendService } from "@spt-aki/services/MailSendService"; -import { AbstractDialogueChatBot } from "@spt-aki/helpers/Dialogue/AbstractDialogueChatBot"; -export declare class CommandoDialogueChatBot extends AbstractDialogueChatBot { - constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[]); +export declare class CommandoDialogueChatBot implements IDialogueChatBot { + protected logger: ILogger; + protected mailSendService: MailSendService; + protected commandoCommands: ICommandoCommand[]; + constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]); + registerCommandoCommand(commandoCommand: ICommandoCommand): void; getChatBot(): IUserDialogInfo; - protected getUnrecognizedCommandMessage(): string; + handleMessage(sessionId: string, request: ISendMessageRequest): string; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/22CustomAkiCommand/types/helpers/DialogueHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/22CustomAkiCommand/types/helpers/HandbookHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/InRaidHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/22CustomAkiCommand/types/helpers/InventoryHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/22CustomAkiCommand/types/helpers/PresetHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/PresetHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/QuestConditionHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/QuestHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/QuestHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/22CustomAkiCommand/types/helpers/RagfairServerHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/22CustomAkiCommand/types/helpers/TraderAssortHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/22CustomAkiCommand/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/22CustomAkiCommand/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts b/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/22CustomAkiCommand/types/loaders/PostAkiModLoader.d.ts b/TypeScript/22CustomAkiCommand/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/22CustomAkiCommand/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/22CustomAkiCommand/types/loaders/PostDBModLoader.d.ts b/TypeScript/22CustomAkiCommand/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/22CustomAkiCommand/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/22CustomAkiCommand/types/loaders/PreAkiModLoader.d.ts b/TypeScript/22CustomAkiCommand/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/22CustomAkiCommand/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/IGlobals.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocation.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocationBase.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/IPmcData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IItem.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IQteData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/BaseClasses.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/BonusSkillType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/BonusType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/ConfigTypes.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/ELocationName.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/ELocationName.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/ItemEventActions.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/MessageType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/MessageType.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/ModSpawn.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/SeasonalEventType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/TraderServiceType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/Traders.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/Traders.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/22CustomAkiCommand/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/22CustomAkiCommand/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotDurability.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IItemConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/server/ILocations.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/services/LootRequest.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/22CustomAkiCommand/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/22CustomAkiCommand/types/routers/ItemEventRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/22CustomAkiCommand/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/22CustomAkiCommand/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/22CustomAkiCommand/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/22CustomAkiCommand/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/22CustomAkiCommand/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/22CustomAkiCommand/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/22CustomAkiCommand/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/22CustomAkiCommand/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/22CustomAkiCommand/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/22CustomAkiCommand/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/22CustomAkiCommand/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/22CustomAkiCommand/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/22CustomAkiCommand/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/22CustomAkiCommand/types/servers/HttpServer.d.ts b/TypeScript/22CustomAkiCommand/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/22CustomAkiCommand/types/servers/HttpServer.d.ts +++ b/TypeScript/22CustomAkiCommand/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/22CustomAkiCommand/types/servers/SaveServer.d.ts b/TypeScript/22CustomAkiCommand/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/22CustomAkiCommand/types/servers/SaveServer.d.ts +++ b/TypeScript/22CustomAkiCommand/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/22CustomAkiCommand/types/servers/WebSocketServer.d.ts b/TypeScript/22CustomAkiCommand/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/22CustomAkiCommand/types/servers/WebSocketServer.d.ts +++ b/TypeScript/22CustomAkiCommand/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/22CustomAkiCommand/types/services/BotEquipmentFilterService.d.ts b/TypeScript/22CustomAkiCommand/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/22CustomAkiCommand/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/BotGenerationCacheService.d.ts b/TypeScript/22CustomAkiCommand/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/22CustomAkiCommand/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/22CustomAkiCommand/types/services/BotLootCacheService.d.ts b/TypeScript/22CustomAkiCommand/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/22CustomAkiCommand/types/services/BotLootCacheService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts b/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/HashCacheService.d.ts b/TypeScript/22CustomAkiCommand/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/22CustomAkiCommand/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/22CustomAkiCommand/types/services/InsuranceService.d.ts b/TypeScript/22CustomAkiCommand/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/22CustomAkiCommand/types/services/InsuranceService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/22CustomAkiCommand/types/services/ItemFilterService.d.ts b/TypeScript/22CustomAkiCommand/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/22CustomAkiCommand/types/services/ItemFilterService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/22CustomAkiCommand/types/services/LocaleService.d.ts b/TypeScript/22CustomAkiCommand/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/22CustomAkiCommand/types/services/LocaleService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/22CustomAkiCommand/types/services/LocalisationService.d.ts b/TypeScript/22CustomAkiCommand/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/22CustomAkiCommand/types/services/LocalisationService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/22CustomAkiCommand/types/services/MatchLocationService.d.ts b/TypeScript/22CustomAkiCommand/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/22CustomAkiCommand/types/services/MatchLocationService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/ModCompilerService.d.ts b/TypeScript/22CustomAkiCommand/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/22CustomAkiCommand/types/services/ModCompilerService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/22CustomAkiCommand/types/services/PaymentService.d.ts b/TypeScript/22CustomAkiCommand/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/22CustomAkiCommand/types/services/PaymentService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/22CustomAkiCommand/types/services/PmcChatResponseService.d.ts b/TypeScript/22CustomAkiCommand/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/22CustomAkiCommand/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/22CustomAkiCommand/types/services/ProfileFixerService.d.ts b/TypeScript/22CustomAkiCommand/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/22CustomAkiCommand/types/services/ProfileFixerService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/RagfairOfferService.d.ts b/TypeScript/22CustomAkiCommand/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/22CustomAkiCommand/types/services/RagfairOfferService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/RagfairPriceService.d.ts b/TypeScript/22CustomAkiCommand/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/22CustomAkiCommand/types/services/RagfairPriceService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/22CustomAkiCommand/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/22CustomAkiCommand/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/22CustomAkiCommand/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/RagfairTaxService.d.ts b/TypeScript/22CustomAkiCommand/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/22CustomAkiCommand/types/services/RagfairTaxService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/22CustomAkiCommand/types/services/RepairService.d.ts b/TypeScript/22CustomAkiCommand/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/22CustomAkiCommand/types/services/RepairService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/22CustomAkiCommand/types/services/SeasonalEventService.d.ts b/TypeScript/22CustomAkiCommand/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/22CustomAkiCommand/types/services/SeasonalEventService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/22CustomAkiCommand/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/22CustomAkiCommand/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/22CustomAkiCommand/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts b/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/22CustomAkiCommand/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/22CustomAkiCommand/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/22CustomAkiCommand/types/services/cache/ModHashCacheService.d.ts b/TypeScript/22CustomAkiCommand/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/22CustomAkiCommand/types/services/mod/CustomItemService.d.ts b/TypeScript/22CustomAkiCommand/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/22CustomAkiCommand/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/22CustomAkiCommand/types/utils/HashUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/HashUtil.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/22CustomAkiCommand/types/utils/HttpFileUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/HttpResponseUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts b/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/22CustomAkiCommand/types/utils/RandomUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/RandomUtil.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/TimeUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/TimeUtil.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/UUidGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/22CustomAkiCommand/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/22CustomAkiCommand/types/utils/VFS.d.ts b/TypeScript/22CustomAkiCommand/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/VFS.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/22CustomAkiCommand/types/utils/Watermark.d.ts b/TypeScript/22CustomAkiCommand/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/Watermark.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/22CustomAkiCommand/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/collections/lists/Nodes.d.ts b/TypeScript/22CustomAkiCommand/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/22CustomAkiCommand/types/utils/collections/queue/Queue.d.ts b/TypeScript/22CustomAkiCommand/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/22CustomAkiCommand/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/22CustomAkiCommand/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/23CustomAbstractChatBot/package.json b/TypeScript/23CustomAbstractChatBot/package.json index e33130c..c2c7c2f 100644 --- a/TypeScript/23CustomAbstractChatBot/package.json +++ b/TypeScript/23CustomAbstractChatBot/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "clodan", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/2EditDatabase/package.json b/TypeScript/2EditDatabase/package.json index dd6b870..3a3b930 100644 --- a/TypeScript/2EditDatabase/package.json +++ b/TypeScript/2EditDatabase/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -16,16 +16,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/2EditDatabase/types/ErrorHandler.d.ts b/TypeScript/2EditDatabase/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/2EditDatabase/types/ErrorHandler.d.ts +++ b/TypeScript/2EditDatabase/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/2EditDatabase/types/Program.d.ts b/TypeScript/2EditDatabase/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/2EditDatabase/types/Program.d.ts +++ b/TypeScript/2EditDatabase/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/2EditDatabase/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/2EditDatabase/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/2EditDatabase/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/2EditDatabase/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/2EditDatabase/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/2EditDatabase/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/2EditDatabase/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/2EditDatabase/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts b/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts +++ b/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/2EditDatabase/types/controllers/AchievementController.d.ts b/TypeScript/2EditDatabase/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/2EditDatabase/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/2EditDatabase/types/controllers/BuildController.d.ts b/TypeScript/2EditDatabase/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/2EditDatabase/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts b/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/2EditDatabase/types/controllers/PresetBuildController.d.ts b/TypeScript/2EditDatabase/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/2EditDatabase/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/2EditDatabase/types/controllers/PresetController.d.ts b/TypeScript/2EditDatabase/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/2EditDatabase/types/controllers/PresetController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/ProfileController.d.ts b/TypeScript/2EditDatabase/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/2EditDatabase/types/controllers/ProfileController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts b/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/2EditDatabase/types/di/Router.d.ts b/TypeScript/2EditDatabase/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/2EditDatabase/types/di/Router.d.ts +++ b/TypeScript/2EditDatabase/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/2EditDatabase/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/2EditDatabase/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/2EditDatabase/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/2EditDatabase/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/2EditDatabase/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/2EditDatabase/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/2EditDatabase/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/2EditDatabase/types/helpers/QuestConditionHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/2EditDatabase/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/2EditDatabase/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/2EditDatabase/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/2EditDatabase/types/loaders/PostAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/2EditDatabase/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/2EditDatabase/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/2EditDatabase/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/ILocation.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/IPmcData.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IItem.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/2EditDatabase/types/models/eft/hideout/IQteData.d.ts b/TypeScript/2EditDatabase/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/2EditDatabase/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/2EditDatabase/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/2EditDatabase/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/2EditDatabase/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/2EditDatabase/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/2EditDatabase/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/2EditDatabase/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/2EditDatabase/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/2EditDatabase/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/2EditDatabase/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/2EditDatabase/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/2EditDatabase/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/2EditDatabase/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/2EditDatabase/types/models/enums/BonusSkillType.d.ts b/TypeScript/2EditDatabase/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/BonusType.d.ts b/TypeScript/2EditDatabase/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/2EditDatabase/types/models/enums/ELocationName.d.ts b/TypeScript/2EditDatabase/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/2EditDatabase/types/models/enums/ELocationName.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts b/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/2EditDatabase/types/models/enums/MessageType.d.ts b/TypeScript/2EditDatabase/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/2EditDatabase/types/models/enums/MessageType.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/2EditDatabase/types/models/enums/ModSpawn.d.ts b/TypeScript/2EditDatabase/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/SeasonalEventType.d.ts b/TypeScript/2EditDatabase/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/2EditDatabase/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/2EditDatabase/types/models/enums/TraderServiceType.d.ts b/TypeScript/2EditDatabase/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/Traders.d.ts b/TypeScript/2EditDatabase/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/2EditDatabase/types/models/enums/Traders.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/QteType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/2EditDatabase/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/2EditDatabase/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/2EditDatabase/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/2EditDatabase/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/2EditDatabase/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotDurability.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/2EditDatabase/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/2EditDatabase/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/2EditDatabase/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/2EditDatabase/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/2EditDatabase/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/2EditDatabase/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/2EditDatabase/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/2EditDatabase/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/2EditDatabase/types/models/spt/server/ILocations.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/2EditDatabase/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/2EditDatabase/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/2EditDatabase/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/2EditDatabase/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/2EditDatabase/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/2EditDatabase/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/2EditDatabase/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/2EditDatabase/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/2EditDatabase/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/2EditDatabase/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/2EditDatabase/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/2EditDatabase/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/2EditDatabase/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/2EditDatabase/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/2EditDatabase/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts b/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts b/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts b/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts b/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts +++ b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts +++ b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/2EditDatabase/types/services/MatchLocationService.d.ts b/TypeScript/2EditDatabase/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/2EditDatabase/types/services/MatchLocationService.d.ts +++ b/TypeScript/2EditDatabase/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts b/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairTaxService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairTaxService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/2EditDatabase/types/services/RepairService.d.ts b/TypeScript/2EditDatabase/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/2EditDatabase/types/services/RepairService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts b/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts +++ b/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts b/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/2EditDatabase/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/2EditDatabase/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/2EditDatabase/types/services/cache/ModHashCacheService.d.ts b/TypeScript/2EditDatabase/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/2EditDatabase/types/services/mod/CustomItemService.d.ts b/TypeScript/2EditDatabase/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/2EditDatabase/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/2EditDatabase/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/2EditDatabase/types/utils/HashUtil.d.ts b/TypeScript/2EditDatabase/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/2EditDatabase/types/utils/HashUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts b/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts b/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts b/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/2EditDatabase/types/utils/UUidGenerator.d.ts b/TypeScript/2EditDatabase/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/2EditDatabase/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/2EditDatabase/types/utils/VFS.d.ts b/TypeScript/2EditDatabase/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/2EditDatabase/types/utils/VFS.d.ts +++ b/TypeScript/2EditDatabase/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts +++ b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/2EditDatabase/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/2EditDatabase/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/2EditDatabase/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/2EditDatabase/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/2EditDatabase/types/utils/collections/lists/Nodes.d.ts b/TypeScript/2EditDatabase/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/2EditDatabase/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/2EditDatabase/types/utils/collections/queue/Queue.d.ts b/TypeScript/2EditDatabase/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/2EditDatabase/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/2EditDatabase/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/2EditDatabase/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/2EditDatabase/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/2EditDatabase/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/2EditDatabase/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/2EditDatabase/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/2EditDatabase/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/2EditDatabase/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/2EditDatabase/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/2EditDatabase/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/2EditDatabase/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/2EditDatabase/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/2EditDatabase/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/3GetSptConfigFile/package.json b/TypeScript/3GetSptConfigFile/package.json index b623e96..6bb83aa 100644 --- a/TypeScript/3GetSptConfigFile/package.json +++ b/TypeScript/3GetSptConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -16,16 +16,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts b/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts +++ b/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/3GetSptConfigFile/types/Program.d.ts b/TypeScript/3GetSptConfigFile/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/3GetSptConfigFile/types/Program.d.ts +++ b/TypeScript/3GetSptConfigFile/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/3GetSptConfigFile/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts b/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts +++ b/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/AchievementController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BuildController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/3GetSptConfigFile/types/controllers/PresetBuildController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/3GetSptConfigFile/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/3GetSptConfigFile/types/controllers/PresetController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/PresetController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/ProfileController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/ProfileController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/3GetSptConfigFile/types/di/Router.d.ts b/TypeScript/3GetSptConfigFile/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/3GetSptConfigFile/types/di/Router.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/3GetSptConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/3GetSptConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestConditionHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/3GetSptConfigFile/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/3GetSptConfigFile/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PostAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocation.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/IPmcData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IItem.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IQteData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BonusSkillType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BonusType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ELocationName.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/ELocationName.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/MessageType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/MessageType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ModSpawn.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/SeasonalEventType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/TraderServiceType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/Traders.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/Traders.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotDurability.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocations.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/3GetSptConfigFile/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/3GetSptConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/3GetSptConfigFile/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/3GetSptConfigFile/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/3GetSptConfigFile/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/3GetSptConfigFile/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/3GetSptConfigFile/types/services/MatchLocationService.d.ts b/TypeScript/3GetSptConfigFile/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/3GetSptConfigFile/types/services/MatchLocationService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairTaxService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairTaxService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts b/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts b/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/cache/ModHashCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/mod/CustomItemService.d.ts b/TypeScript/3GetSptConfigFile/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/3GetSptConfigFile/types/utils/HashUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/HashUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/UUidGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/3GetSptConfigFile/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/3GetSptConfigFile/types/utils/VFS.d.ts b/TypeScript/3GetSptConfigFile/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/VFS.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/3GetSptConfigFile/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/collections/lists/Nodes.d.ts b/TypeScript/3GetSptConfigFile/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/3GetSptConfigFile/types/utils/collections/queue/Queue.d.ts b/TypeScript/3GetSptConfigFile/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/3GetSptConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/package.json b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/package.json index f9b55b2..cbec90a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/package.json +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ErrorHandler.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ErrorHandler.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/Program.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/Program.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BundleCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InraidCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/MatchCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/context/ApplicationContext.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/context/ApplicationContext.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/AchievementController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BotController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BuildController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LauncherController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LauncherController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LocationController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetBuildController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/ProfileController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/ProfileController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepairController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepairController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TradeController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TradeController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TraderController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/di/Router.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/di/Router.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLevelGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PlayerScavGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/AssortHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/AssortHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ContainerHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/PresetHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/PresetHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestConditionHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostAkiModLoader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostDBModLoader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocation.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocationBase.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IPmcData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 8ff3ba9..cfcc831 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotType.d.ts index 53a8021..db6e56e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IItem.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IQuest.d.ts index edd9849..7e576ce 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index 8101c51..854c8ef 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITrader.d.ts index 83353de..38f2a43 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IQteData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusSkillType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ELocationName.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ELocationName.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ItemEventActions.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/MessageType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/MessageType.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ModSpawn.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/SeasonalEventType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/TraderServiceType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/Traders.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/Traders.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotDurability.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ILocations.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/ItemEventRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/HttpServer.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/SaveServer.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/SaveServer.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/WebSocketServer.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/WebSocketServer.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/HashCacheService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/InsuranceService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocaleService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocalisationService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocalisationService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MatchLocationService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MatchLocationService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PaymentService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PmcChatResponseService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairTaxService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairTaxService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RepairService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RepairService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/SeasonalEventService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/SeasonalEventService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/ModHashCacheService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/mod/CustomItemService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HashUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HashUtil.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpFileUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpResponseUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/TimeUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/TimeUtil.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/UUidGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/VFS.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/VFS.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/Watermark.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/Nodes.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/queue/Queue.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/4UseACustomConfigFile/package.json b/TypeScript/4UseACustomConfigFile/package.json index 8ad9c7c..890050e 100644 --- a/TypeScript/4UseACustomConfigFile/package.json +++ b/TypeScript/4UseACustomConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts b/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/Program.d.ts b/TypeScript/4UseACustomConfigFile/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/4UseACustomConfigFile/types/Program.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts b/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/AchievementController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BuildController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/PresetBuildController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/4UseACustomConfigFile/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/PresetController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/PresetController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/ProfileController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/ProfileController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/4UseACustomConfigFile/types/di/Router.d.ts b/TypeScript/4UseACustomConfigFile/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/Router.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/4UseACustomConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestConditionHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/4UseACustomConfigFile/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/4UseACustomConfigFile/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PostAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocation.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IPmcData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IItem.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IQteData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BonusSkillType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BonusType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ELocationName.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/ELocationName.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/MessageType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/MessageType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ModSpawn.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/SeasonalEventType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/TraderServiceType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/Traders.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/Traders.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotDurability.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocations.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/4UseACustomConfigFile/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/4UseACustomConfigFile/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/4UseACustomConfigFile/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/4UseACustomConfigFile/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/4UseACustomConfigFile/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/MatchLocationService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/MatchLocationService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairTaxService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairTaxService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/cache/ModHashCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/mod/CustomItemService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/4UseACustomConfigFile/types/utils/HashUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/HashUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/UUidGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/4UseACustomConfigFile/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/VFS.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/VFS.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/Nodes.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/collections/queue/Queue.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/5ReplaceMethod/package.json b/TypeScript/5ReplaceMethod/package.json index a033a07..a77eafc 100644 --- a/TypeScript/5ReplaceMethod/package.json +++ b/TypeScript/5ReplaceMethod/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts b/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts +++ b/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/5ReplaceMethod/types/Program.d.ts b/TypeScript/5ReplaceMethod/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/5ReplaceMethod/types/Program.d.ts +++ b/TypeScript/5ReplaceMethod/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/5ReplaceMethod/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/5ReplaceMethod/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts b/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts +++ b/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/5ReplaceMethod/types/controllers/AchievementController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/5ReplaceMethod/types/controllers/BuildController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/5ReplaceMethod/types/controllers/PresetBuildController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/5ReplaceMethod/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/5ReplaceMethod/types/controllers/PresetController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/PresetController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/ProfileController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/ProfileController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/5ReplaceMethod/types/di/Router.d.ts b/TypeScript/5ReplaceMethod/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/5ReplaceMethod/types/di/Router.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/5ReplaceMethod/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/5ReplaceMethod/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestConditionHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/5ReplaceMethod/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/5ReplaceMethod/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/5ReplaceMethod/types/loaders/PostAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/5ReplaceMethod/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocation.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/IPmcData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IItem.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IQteData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BonusSkillType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BonusType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ELocationName.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/ELocationName.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/MessageType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/MessageType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ModSpawn.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/SeasonalEventType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/TraderServiceType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/Traders.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/Traders.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotDurability.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocations.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/5ReplaceMethod/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/5ReplaceMethod/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/5ReplaceMethod/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/5ReplaceMethod/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/5ReplaceMethod/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/5ReplaceMethod/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/5ReplaceMethod/types/services/MatchLocationService.d.ts b/TypeScript/5ReplaceMethod/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/5ReplaceMethod/types/services/MatchLocationService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts b/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairTaxService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairTaxService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts b/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts b/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts b/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/5ReplaceMethod/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/cache/ModHashCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/mod/CustomItemService.d.ts b/TypeScript/5ReplaceMethod/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/5ReplaceMethod/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/5ReplaceMethod/types/utils/HashUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/5ReplaceMethod/types/utils/HashUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/5ReplaceMethod/types/utils/UUidGenerator.d.ts b/TypeScript/5ReplaceMethod/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/5ReplaceMethod/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/5ReplaceMethod/types/utils/VFS.d.ts b/TypeScript/5ReplaceMethod/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/5ReplaceMethod/types/utils/VFS.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/5ReplaceMethod/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/5ReplaceMethod/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/5ReplaceMethod/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/5ReplaceMethod/types/utils/collections/lists/Nodes.d.ts b/TypeScript/5ReplaceMethod/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/5ReplaceMethod/types/utils/collections/queue/Queue.d.ts b/TypeScript/5ReplaceMethod/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/5ReplaceMethod/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/5ReplaceMethod/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/5ReplaceMethod/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/5ReplaceMethod/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/5ReplaceMethod/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/5ReplaceMethod/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/5ReplaceMethod/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/5ReplaceMethod/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/5ReplaceMethod/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/package.json b/TypeScript/6ReferenceAnotherClass/package.json index 27de82d..2fc0281 100644 --- a/TypeScript/6ReferenceAnotherClass/package.json +++ b/TypeScript/6ReferenceAnotherClass/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts b/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/Program.d.ts b/TypeScript/6ReferenceAnotherClass/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/6ReferenceAnotherClass/types/Program.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts b/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/AchievementController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BuildController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/PresetBuildController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/PresetController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/PresetController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/ProfileController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/ProfileController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/di/Router.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/Router.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestConditionHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/6ReferenceAnotherClass/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/6ReferenceAnotherClass/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PostAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocation.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IPmcData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IItem.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IQteData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusSkillType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ELocationName.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/ELocationName.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/MessageType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/MessageType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ModSpawn.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/SeasonalEventType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/TraderServiceType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/Traders.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/Traders.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotDurability.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocations.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/MatchLocationService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/MatchLocationService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairTaxService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairTaxService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/cache/ModHashCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/mod/CustomItemService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/HashUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/HashUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/UUidGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/VFS.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/VFS.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/Nodes.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/collections/queue/Queue.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/7OnLoadHook/package.json b/TypeScript/7OnLoadHook/package.json index 3cfe862..7bfd6e4 100644 --- a/TypeScript/7OnLoadHook/package.json +++ b/TypeScript/7OnLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts b/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts +++ b/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/7OnLoadHook/types/Program.d.ts b/TypeScript/7OnLoadHook/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/7OnLoadHook/types/Program.d.ts +++ b/TypeScript/7OnLoadHook/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/7OnLoadHook/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/7OnLoadHook/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/7OnLoadHook/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/7OnLoadHook/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/7OnLoadHook/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts b/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/7OnLoadHook/types/controllers/AchievementController.d.ts b/TypeScript/7OnLoadHook/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/7OnLoadHook/types/controllers/BuildController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/7OnLoadHook/types/controllers/PresetBuildController.d.ts b/TypeScript/7OnLoadHook/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/7OnLoadHook/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/7OnLoadHook/types/controllers/PresetController.d.ts b/TypeScript/7OnLoadHook/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/7OnLoadHook/types/controllers/PresetController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/ProfileController.d.ts b/TypeScript/7OnLoadHook/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/7OnLoadHook/types/controllers/ProfileController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts b/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/7OnLoadHook/types/di/Router.d.ts b/TypeScript/7OnLoadHook/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/7OnLoadHook/types/di/Router.d.ts +++ b/TypeScript/7OnLoadHook/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/7OnLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/7OnLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/7OnLoadHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/7OnLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/7OnLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestConditionHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/7OnLoadHook/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/7OnLoadHook/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/7OnLoadHook/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/7OnLoadHook/types/loaders/PostAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/7OnLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/ILocation.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/IPmcData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IItem.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/7OnLoadHook/types/models/eft/hideout/IQteData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/7OnLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/7OnLoadHook/types/models/enums/BonusSkillType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/BonusType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/ELocationName.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/ELocationName.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/MessageType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/MessageType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/7OnLoadHook/types/models/enums/ModSpawn.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/SeasonalEventType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/TraderServiceType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/Traders.d.ts b/TypeScript/7OnLoadHook/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/Traders.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/QteType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotDurability.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/7OnLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/7OnLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/7OnLoadHook/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/7OnLoadHook/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/7OnLoadHook/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/ILocations.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/7OnLoadHook/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/7OnLoadHook/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/7OnLoadHook/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/7OnLoadHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/7OnLoadHook/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/7OnLoadHook/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/7OnLoadHook/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/7OnLoadHook/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts b/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts b/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/7OnLoadHook/types/services/MatchLocationService.d.ts b/TypeScript/7OnLoadHook/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/7OnLoadHook/types/services/MatchLocationService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts b/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairTaxService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairTaxService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/7OnLoadHook/types/services/RepairService.d.ts b/TypeScript/7OnLoadHook/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/7OnLoadHook/types/services/RepairService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts b/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts b/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/7OnLoadHook/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/cache/ModHashCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/mod/CustomItemService.d.ts b/TypeScript/7OnLoadHook/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/7OnLoadHook/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/7OnLoadHook/types/utils/HashUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/7OnLoadHook/types/utils/HashUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/7OnLoadHook/types/utils/UUidGenerator.d.ts b/TypeScript/7OnLoadHook/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/7OnLoadHook/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/7OnLoadHook/types/utils/VFS.d.ts b/TypeScript/7OnLoadHook/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/7OnLoadHook/types/utils/VFS.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/7OnLoadHook/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/7OnLoadHook/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/7OnLoadHook/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/7OnLoadHook/types/utils/collections/lists/Nodes.d.ts b/TypeScript/7OnLoadHook/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/7OnLoadHook/types/utils/collections/queue/Queue.d.ts b/TypeScript/7OnLoadHook/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/7OnLoadHook/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/7OnLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/7OnLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/7OnLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/7OnLoadHook/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/7OnLoadHook/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/7OnLoadHook/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/7OnLoadHook/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/7OnLoadHook/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/7OnLoadHook/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/8OnUpdateHook/package.json b/TypeScript/8OnUpdateHook/package.json index 187ff11..527d17d 100644 --- a/TypeScript/8OnUpdateHook/package.json +++ b/TypeScript/8OnUpdateHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts b/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts +++ b/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/8OnUpdateHook/types/Program.d.ts b/TypeScript/8OnUpdateHook/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/8OnUpdateHook/types/Program.d.ts +++ b/TypeScript/8OnUpdateHook/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/8OnUpdateHook/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/8OnUpdateHook/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts b/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/8OnUpdateHook/types/controllers/AchievementController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/8OnUpdateHook/types/controllers/BuildController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/8OnUpdateHook/types/controllers/PresetBuildController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/8OnUpdateHook/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/8OnUpdateHook/types/controllers/PresetController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/PresetController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/ProfileController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/ProfileController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/8OnUpdateHook/types/di/Router.d.ts b/TypeScript/8OnUpdateHook/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/8OnUpdateHook/types/di/Router.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/8OnUpdateHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/8OnUpdateHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/ContainerHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestConditionHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/8OnUpdateHook/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/8OnUpdateHook/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/8OnUpdateHook/types/loaders/PostAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/8OnUpdateHook/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocation.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/IPmcData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IItem.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IQteData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BonusSkillType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BonusType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ELocationName.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/ELocationName.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/MessageType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/MessageType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ModSpawn.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/SeasonalEventType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/TraderServiceType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/Traders.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/Traders.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotDurability.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocations.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/8OnUpdateHook/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/8OnUpdateHook/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/8OnUpdateHook/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/8OnUpdateHook/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/8OnUpdateHook/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/8OnUpdateHook/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/8OnUpdateHook/types/services/MatchLocationService.d.ts b/TypeScript/8OnUpdateHook/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/8OnUpdateHook/types/services/MatchLocationService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts b/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairTaxService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairTaxService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts b/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts b/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts b/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/8OnUpdateHook/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/cache/ModHashCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/mod/CustomItemService.d.ts b/TypeScript/8OnUpdateHook/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/8OnUpdateHook/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/8OnUpdateHook/types/utils/HashUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/8OnUpdateHook/types/utils/HashUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/8OnUpdateHook/types/utils/UUidGenerator.d.ts b/TypeScript/8OnUpdateHook/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/8OnUpdateHook/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/8OnUpdateHook/types/utils/VFS.d.ts b/TypeScript/8OnUpdateHook/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/8OnUpdateHook/types/utils/VFS.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/8OnUpdateHook/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/8OnUpdateHook/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/8OnUpdateHook/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/8OnUpdateHook/types/utils/collections/lists/Nodes.d.ts b/TypeScript/8OnUpdateHook/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/8OnUpdateHook/types/utils/collections/queue/Queue.d.ts b/TypeScript/8OnUpdateHook/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/8OnUpdateHook/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/8OnUpdateHook/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/8OnUpdateHook/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/8OnUpdateHook/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/8OnUpdateHook/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/8OnUpdateHook/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/8OnUpdateHook/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/8OnUpdateHook/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/8OnUpdateHook/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/9RouterHooks/package.json b/TypeScript/9RouterHooks/package.json index 7060892..ff9cff6 100644 --- a/TypeScript/9RouterHooks/package.json +++ b/TypeScript/9RouterHooks/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "~3.7", + "akiVersion": "~3.8", "loadBefore": [], "loadAfter": [], "incompatibilities": [], @@ -15,16 +15,16 @@ "buildinfo": "node ./build.mjs --verbose" }, "devDependencies": { - "@types/node": "18.18.4", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", + "@types/node": "20.11", + "@typescript-eslint/eslint-plugin": "7.2", + "@typescript-eslint/parser": "7.2", "archiver": "^6.0", - "eslint": "8.51.0", - "fs-extra": "^11.1", + "eslint": "8.57", + "fs-extra": "11.2", "ignore": "^5.2", "os": "^0.1", "tsyringe": "4.8.0", - "typescript": "5.2.2", - "winston": "3.11.0" + "typescript": "5.4", + "winston": "3.12" } } diff --git a/TypeScript/9RouterHooks/types/ErrorHandler.d.ts b/TypeScript/9RouterHooks/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/TypeScript/9RouterHooks/types/ErrorHandler.d.ts +++ b/TypeScript/9RouterHooks/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/TypeScript/9RouterHooks/types/Program.d.ts b/TypeScript/9RouterHooks/types/Program.d.ts index afe5216..f2b65df 100644 --- a/TypeScript/9RouterHooks/types/Program.d.ts +++ b/TypeScript/9RouterHooks/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/TypeScript/9RouterHooks/types/callbacks/AchievementCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/TypeScript/9RouterHooks/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/TypeScript/9RouterHooks/types/callbacks/BuildsCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/TypeScript/9RouterHooks/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts index a49b8ec..f6a664d 100644 --- a/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; -import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): void; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/TypeScript/9RouterHooks/types/callbacks/ClientLogCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ClientLogCallbacks.d.ts index 8414b49..1fb7acc 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ClientLogCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ClientLogCallbacks.d.ts @@ -1,14 +1,28 @@ import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** Handle client logging related events */ export declare class ClientLogCallbacks { protected httpResponse: HttpResponseUtil; protected clientLogController: ClientLogController; - constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController); + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); /** * Handle /singleplayer/log */ clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts index 09124c6..51c7595 100644 --- a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts @@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad { getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; /** - * Handle singleplayer/settings/getRaidTime - * @returns string - */ + * Handle singleplayer/settings/getRaidTime + * @returns string + */ getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts index 65c989a..c1fa7a5 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts @@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ diff --git a/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts index ea77d62..29e2c96 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts @@ -1,5 +1,7 @@ import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts index ddbb070..5aa0cb2 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts @@ -1,4 +1,5 @@ import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; @@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts index b040607..b54d0f6 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts @@ -9,5 +9,11 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts index a6f2ccf..ae47754 100644 --- a/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts @@ -1,16 +1,14 @@ import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -39,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -71,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/9RouterHooks/types/callbacks/PresetBuildCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/PresetBuildCallbacks.d.ts deleted file mode 100644 index f5a4c49..0000000 --- a/TypeScript/9RouterHooks/types/callbacks/PresetBuildCallbacks.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController"; -import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; -export declare class PresetBuildCallbacks { - protected httpResponse: HttpResponseUtil; - protected presetBuildController: PresetBuildController; - constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/9RouterHooks/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ProfileCallbacks.d.ts index 2e1db38..e3d53e9 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ProfileCallbacks.d.ts @@ -1,4 +1,5 @@ import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; @@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -20,7 +23,8 @@ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ @@ -62,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts index bad2ce0..5dc21d0 100644 --- a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts @@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts index 3002b62..6f0929f 100644 --- a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts @@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts b/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts index 5eea16e..22c6c0e 100644 --- a/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts +++ b/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts @@ -5,14 +5,13 @@ export declare class ApplicationContext { private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); - * @param type - * @returns + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; diff --git a/TypeScript/9RouterHooks/types/controllers/AchievementController.d.ts b/TypeScript/9RouterHooks/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/TypeScript/9RouterHooks/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts index f7ba1aa..d148abc 100644 --- a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts @@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,22 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -48,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -60,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/TypeScript/9RouterHooks/types/controllers/BuildController.d.ts b/TypeScript/9RouterHooks/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/TypeScript/9RouterHooks/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts index 8d47886..0cb31c1 100644 --- a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts @@ -110,7 +110,7 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index d2a978b..9feb6cc 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; @@ -59,21 +61,23 @@ export declare class GameController { protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; + protected botConfig: IBotConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; /** * Out of date/incorrectly made trader mods forget this data */ protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -112,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -130,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -139,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index 5595648..23bdd1e 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -1,11 +1,12 @@ import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -45,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -58,27 +60,28 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile @@ -202,26 +205,23 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this @@ -236,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -244,7 +244,7 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 8ec13ba..1f923dd 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks @@ -38,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -66,8 +84,8 @@ export declare class InraidController { */ protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile * @param sessionID Session id @@ -75,7 +93,7 @@ export declare class InraidController { */ protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -83,15 +101,29 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid * @param sessionID Session id * @param postRaidRequest Post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; /** * Does provided profile contain any condition counters * @param profile Profile to check for condition counters @@ -128,8 +160,9 @@ export declare class InraidController { * Update profile with scav karma values based on in-raid actions * @param pmcData Pmc profile * @param offraidData Post-raid save request + * @param scavData Scav profile */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -140,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts index 64c2ae8..e9e377d 100644 --- a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts @@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,7 @@ export declare class InsuranceController { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; protected roubleTpl: string; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * @@ -66,6 +70,12 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Count all items in all insurance packages. + * @param insurance + * @returns + */ + protected countAllInsuranceItems(insurance: Insurance[]): number; /** * Remove an insurance package from a profile using the package's system data information. * @@ -73,31 +83,35 @@ export declare class InsuranceController { * @param index The array index of the insurance package to remove. * @returns void */ - protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** * Finds the items that should be deleted based on the given Insurance object. * - * @param insured The insurance object containing the items to evaluate for deletion. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): Set; - /** - * Populate a Map object of items for quick lookup by their ID. - * - * @param insured The insurance object containing the items to populate the map with. - * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. - */ - protected populateItemsMap(insured: Insurance): Map; + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; /** * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, * not the backpack that the gun is located in (the gun's parent). * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map): Map; + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; /** * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, @@ -105,15 +119,13 @@ export declare class InsuranceController { * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - protected processRegularItems(insured: Insurance, toDelete: Set): void; + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; /** * Process parent items and their attachments, updating the toDelete Set accordingly. * - * This method iterates over a map of parent items to their attachments and performs evaluations on each. - * It marks items for deletion based on certain conditions and updates the toDelete Set accordingly. - * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -169,40 +181,23 @@ export declare class InsuranceController { * @returns void */ protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; - /** - * Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been - * deleted from insurance, but any insured items within the parent should remain. This method will remove the - * reference from the children to the parent and set item properties to main-level values. - * - * @param insured Insurance object containing items. - */ - protected adoptOrphanedItems(insured: Insurance): void; - /** - * Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this - * method should be a reliable way to fetch it, if it ever does change. - * - * @param items Array of items to search through. - * @returns The parentId of an item with slotId 'hideout'. Empty string if not found. - */ - protected fetchHideoutItemParent(items: Item[]): string; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * * @param traderId The ID of the trader who insured the item. * @param insuredItem Optional. The item to roll for. Only used for logging. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForDelete(traderId: string, insuredItem?: Item): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts index 02e2127..7597437 100644 --- a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts @@ -1,4 +1,5 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; @@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -47,6 +50,7 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; @@ -55,7 +59,7 @@ export declare class InventoryController { protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -64,55 +68,52 @@ export declare class InventoryController { * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment @@ -122,7 +123,7 @@ export declare class InventoryController { /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -147,31 +148,32 @@ export declare class InventoryController { * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; /** * Unbind an inventory item from quick access menu at bottom of player screen * Handle unbind event * @param pmcData Player profile * @param bindRequest Request object * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; - protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -179,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -216,10 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; - redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts b/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts index 5de2416..cfed796 100644 --- a/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts @@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -25,7 +29,7 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" @@ -36,6 +40,8 @@ export declare class LauncherController { login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts index eb4144a..5595baf 100644 --- a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts @@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -28,6 +29,7 @@ export declare class LocationController { protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; @@ -35,7 +37,7 @@ export declare class LocationController { protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -59,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index ca950b1..6b1a7c3 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; -import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -43,15 +41,11 @@ export declare class MatchController { protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ diff --git a/TypeScript/9RouterHooks/types/controllers/PresetBuildController.d.ts b/TypeScript/9RouterHooks/types/controllers/PresetBuildController.d.ts deleted file mode 100644 index 7aa10e1..0000000 --- a/TypeScript/9RouterHooks/types/controllers/PresetBuildController.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { SaveServer } from "@spt-aki/servers/SaveServer"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class PresetBuildController { - protected logger: ILogger; - protected hashUtil: HashUtil; - protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/9RouterHooks/types/controllers/PresetController.d.ts b/TypeScript/9RouterHooks/types/controllers/PresetController.d.ts index c1ae523..2e40723 100644 --- a/TypeScript/9RouterHooks/types/controllers/PresetController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/ProfileController.d.ts b/TypeScript/9RouterHooks/types/controllers/ProfileController.d.ts index b1b7b8b..41d8658 100644 --- a/TypeScript/9RouterHooks/types/controllers/ProfileController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/ProfileController.d.ts @@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; @@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -59,6 +64,11 @@ export declare class ProfileController { * @returns Profiles _id value */ createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -101,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts index 140573b..786b3d3 100644 --- a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts @@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -113,6 +108,12 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; /** * Remove a quest entirely from a profile * @param sessionId Player id @@ -133,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -141,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -179,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -188,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index 71cbbbc..0c01b7d 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -69,9 +70,17 @@ 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, ragfairTaxService: RagfairTaxService, 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); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -80,7 +89,7 @@ export declare class RagfairController { /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -89,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -108,16 +109,26 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * 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 + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; /** * Check all profiles and sell player offers / send player money for listing if it sold @@ -163,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts index 070f348..7ec47ff 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts @@ -1,3 +1,4 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts index 7068128..aae8473 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts @@ -1,13 +1,13 @@ import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -30,7 +30,6 @@ export declare class RepeatableQuestController { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; protected paymentService: PaymentService; protected objectId: ObjectId; @@ -39,7 +38,7 @@ export declare class RepeatableQuestController { protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -62,9 +61,9 @@ export declare class RepeatableQuestController { * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; /** @@ -95,6 +94,20 @@ export declare class RepeatableQuestController { */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; + /** + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it + */ + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; + /** + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location + */ + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; /** * Handle RepeatableQuestChange event diff --git a/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts b/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts index 3824e2b..ce4d02d 100644 --- a/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts @@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; import { Traders } from "@spt-aki/models/enums/Traders"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ export declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Buy an item off the flea sold by a trader + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client + */ + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; /** Handle SellAllFromSavage event */ sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Send the specified rouble total to player as mail * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,5 +96,4 @@ export declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts index d85977f..6f1a92f 100644 --- a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts @@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { FenceService } from "@spt-aki/services/FenceService"; import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/TypeScript/9RouterHooks/types/di/Router.d.ts b/TypeScript/9RouterHooks/types/di/Router.d.ts index b77dece..79f3324 100644 --- a/TypeScript/9RouterHooks/types/di/Router.d.ts +++ b/TypeScript/9RouterHooks/types/di/Router.d.ts @@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { handleLoad(profile: IAkiProfile): IAkiProfile; diff --git a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts index 2e73798..dd1dcce 100644 --- a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts @@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; 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); + 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, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, 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[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * 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 weaponId 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 botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain 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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: 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 @@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(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 + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true @@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator { * @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 + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; /** * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible * @param weapon Weapon @@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator { * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * 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 parentSlot item mod will go into, used to get compatible 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; + protected getRandomModTplFromItemDb(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 slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): 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) @@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator { */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index 8144f70..520c75d 100644 --- a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts @@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 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 + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts index cd3609f..4ecd672 100644 --- a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts @@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances 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, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): 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 + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * 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 itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts index c8b590f..220569b 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ 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 + * Get the highest level a bot can be relative to the players level, but no further 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: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts index 7a4c521..014617e 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts @@ -1,7 +1,8 @@ import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; @@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,17 +72,26 @@ export declare class BotLootGenerator { */ 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 - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to @@ -87,44 +102,28 @@ export declare class BotLootGenerator { * @param isPmc are we generating for a pmc */ 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 - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc Is money on a PMC bot + * @param botRole Role bot has that has money stack * @param itemTemplate item details from db * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack * @param isPmc Is ammo on a PMC bot @@ -135,11 +134,10 @@ export declare class BotLootGenerator { /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts index 5eab03e..c1eabde 100644 --- a/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,5 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/TypeScript/9RouterHooks/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/TypeScript/9RouterHooks/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/TypeScript/9RouterHooks/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts index 1305af1..ae16be4 100644 --- a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts @@ -1,7 +1,6 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index d8e816c..6af5c3a 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { LootItem } from "@spt-aki/models/spt/services/LootItem"; import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; @@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts index 251bde2..4f487be 100644 --- a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts @@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts index feea27f..67967dd 100644 --- a/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts @@ -1,11 +1,10 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -24,7 +23,6 @@ export declare class PlayerScavGenerator { protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, 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 * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/TypeScript/9RouterHooks/types/generators/RagfairAssortGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairAssortGenerator.d.ts index 26acae2..10f13f2 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairAssortGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairAssortGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; @@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index 25316c0..46e61a3 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -119,22 +119,28 @@ 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[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts index 35297fa..d020fac 100644 --- a/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts @@ -1,53 +1,34 @@ -import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; -import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { PaymentService } from "@spt-aki/services/PaymentService"; -import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; -import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; import { ObjectId } from "@spt-aki/utils/ObjectId"; import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestGenerator { - protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; - protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; - protected profileHelper: ProfileHelper; - protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; - protected eventOutputHolder: EventOutputHolder; protected localisationService: LocalisationService; - protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); /** * 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 @@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator { * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Get a number of kills neded to complete elimination quest * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage @@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator { * @param {string} location the location on which to fulfill the elimination quest * @returns {IEliminationCondition} object of "Elimination"-location-subcondition */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; /** * Create kill condition for an elimination quest * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" @@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator { * @param allowedWeaponCategory What category of weapon must be used - undefined = any * @returns IEliminationCondition object */ - protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; /** * Generates a valid Completion quest * @@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; /** * Generates a valid Exploration quest * @@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) * @param locationKey e.g factory4_day @@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards; - /** - * Should reward item have stack size increased (25% chance) - * @param item Item to possibly increase stack size of - * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking - * @returns True if it should - */ - protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; - /** - * Get a randomised number a reward items stack size should be based on its handbook price - * @param item Reward item to get stack size for - * @returns Stack size value - */ - protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; - /** - * Select a number of items that have a colelctive value of the passed in parameter - * @param repeatableConfig Config - * @param roublesBudget Total value of items to return - * @returns Array of reward items that fit budget - */ - protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl ItemId of the rewarded item - * @param {integer} value Amount of items to give - * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index - * @returns {object} Object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig Config file - * @returns List of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns True if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; /** * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json * The templates include Elimination, Completion and Extraction quest types diff --git a/TypeScript/9RouterHooks/types/generators/RepeatableQuestRewardGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..d994996 --- /dev/null +++ b/TypeScript/9RouterHooks/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts index 11e1bc3..26f3412 100644 --- a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { Product } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; @@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards @@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; - /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) diff --git a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts index 5501ee6..dec30cd 100644 --- a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index edc4734..bc301a1 100644 --- a/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,5 +1,6 @@ import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; @@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; /** - * Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool * @param weaponTpl Weapon to get mag for * @returns tpl of magazine */ diff --git a/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts index 52dda35..2ed2174 100644 --- a/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts index e7f32ed..7f7555b 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts @@ -1,15 +1,19 @@ import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; @@ -17,12 +21,14 @@ export declare class BotGeneratorHelper { protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -30,7 +36,7 @@ export declare class BotGeneratorHelper { * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts index 293abb1..e38bebc 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,13 +1,11 @@ -import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; -import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; -import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; @@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper { protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * Is the provided item allowed inside a container - * @param slotGrid Items sub-grid we want to place item inside - * @param itemTpl Item tpl being placed - * @returns True if allowed - */ - protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/helpers/ContainerHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/TypeScript/9RouterHooks/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/SptDialogueChatBot.d.ts index a852dfe..f858ab8 100644 --- a/TypeScript/9RouterHooks/types/helpers/Dialogue/SptDialogueChatBot.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { GiftService } from "@spt-aki/services/GiftService"; import { MailSendService } from "@spt-aki/services/MailSendService"; @@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot { protected giftService: GiftService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); getChatBot(): IUserDialogInfo; /** diff --git a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts index ea1b517..2ad4536 100644 --- a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts @@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts index 1e7dffa..c6311e0 100644 --- a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,7 @@ import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { @@ -14,9 +17,11 @@ export declare class LookupCollection { export declare class HandbookHelper { protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -28,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId diff --git a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts index 0cfc649..282b2f0 100644 --- a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts @@ -1,15 +1,16 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PlayerService } from "@spt-aki/services/PlayerService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,15 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Get a count of bitcoins player miner can hold + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected getBitcoinMinerContainerSlotSize(): number; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -213,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -226,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -251,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index b2bba8c..a72c598 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; @@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { @@ -31,9 +32,10 @@ export declare class InRaidHelper { protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -45,19 +47,6 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -74,7 +63,7 @@ export declare class InRaidHelper { */ protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** Check counters are correct in profile */ - protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; /** * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic * @param pmcData Server PMC profile @@ -109,6 +98,12 @@ export declare class InRaidHelper { * @param tradersClientProfile Client */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -129,16 +124,15 @@ export declare class InRaidHelper { * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts index 0bf2925..47a98bf 100644 --- a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts @@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export interface OwnerInventoryItems { +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,53 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -98,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -116,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -172,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index c7daa8c..3e91ef7 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -32,8 +32,8 @@ export declare class ItemHelper { constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, 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 - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -51,6 +51,44 @@ export declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total 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 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * 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 @@ -83,43 +121,6 @@ export declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -131,7 +132,14 @@ export declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -149,17 +157,18 @@ export declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -192,28 +201,42 @@ export declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively 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 Items tpl to check parents of @@ -251,12 +274,6 @@ export declare class ItemHelper { * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. * - * To generate the map: - * ``` - * const itemsMap = new Map(); - * items.forEach(item => itemsMap.set(item._id, item)); - * ``` - * * @param itemId - The unique identifier of the item for which to find the main parent. * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. @@ -269,6 +286,22 @@ export declare class ItemHelper { * @returns true if the item is attached attachment, otherwise false. */ isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -281,13 +314,19 @@ export declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -303,16 +342,17 @@ export declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -323,18 +363,20 @@ export declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -348,6 +390,71 @@ export declare class ItemHelper { */ getItemName(itemTpl: string): string; getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts index 6722c92..8864999 100644 --- a/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts index 938c796..182806d 100644 --- a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts @@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -22,18 +26,25 @@ export declare class ProfileHelper { protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; protected localisationService: LocalisationService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService); + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -45,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -120,5 +164,23 @@ export declare class ProfileHelper { * @returns */ addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/TypeScript/9RouterHooks/types/helpers/QuestConditionHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestConditionHelper.d.ts index 1e4c5f7..afb76f2 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestConditionHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index 2b9a531..ca7270e 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -1,6 +1,7 @@ import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; @@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; @@ -40,10 +41,11 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -84,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -120,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -170,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -222,7 +235,7 @@ export declare class QuestHelper { * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -232,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -253,4 +266,10 @@ export declare class QuestHelper { */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts index 778d657..31bdc05 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts @@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,7 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; /** * Does the passed in item have a condition property * @param item Item to check diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts index 4d2d4c4..e93a2d8 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts @@ -53,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -96,11 +102,4 @@ export declare class RagfairServerHelper { * @returns */ getPresetItemsByTpl(item: Item): Item[]; - /** - * Generate new unique ids for child items while preserving hierarchy - * @param rootItem Base/primary item of preset - * @param preset Primary item + children of primary item - * @returns Item array with new IDs - */ - reparentPresets(rootItem: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts index bf8360d..d997dae 100644 --- a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts @@ -1,63 +1,68 @@ import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { RagfairServer } from "@spt-aki/servers/RagfairServer"; import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought - */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from * @param assortBeingPurchased the item from trader being bought * @param assortId Id of assort being purchased - * @param count How many are being bought + * @param count How many of the item are being bought */ - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts index 0b6effb..0987ff4 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts @@ -48,6 +48,11 @@ export declare class TraderAssortHelper { * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index 8d8da00..256ebf8 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -59,7 +59,7 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; @@ -74,13 +74,13 @@ export declare class TraderHelper { * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -117,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/9RouterHooks/types/ide/BleedingEdgeModsEntry.d.ts b/TypeScript/9RouterHooks/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/TypeScript/9RouterHooks/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts index 8e24c5a..90f4ea9 100644 --- a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/TypeScript/9RouterHooks/types/loaders/PostAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PostAkiModLoader.d.ts index bd0731a..8219fc4 100644 --- a/TypeScript/9RouterHooks/types/loaders/PostAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { VFS } from "@spt-aki/utils/VFS"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts index d57e321..1adac53 100644 --- a/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts index 71fd745..0d297d9 100644 --- a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts @@ -1,5 +1,4 @@ import { DependencyContainer } from "tsyringe"; -import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; @@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader { protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; @@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader { protected akiConfig: ICoreConfig; protected serverDependencies: Record; protected skippedMods: Set; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader { protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; /** * Execute each mod found in this.imported - * @param container Dependence container to give to mod when it runs * @returns void promise */ - protected executeModsAsync(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; /** * Read loadorder.json (create if doesnt exist) and return sorted list of mods * @returns string array of sorted mod names diff --git a/TypeScript/9RouterHooks/types/models/eft/builds/ISetMagazineRequest.d.ts b/TypeScript/9RouterHooks/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts index 276514e..e5aaa4a 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts @@ -5,6 +5,7 @@ export interface IGlobals { config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/ILocation.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/ILocation.d.ts index bba2db0..1fa0a2b 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/ILocation.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts index 1121e9f..99f5c9c 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/IPmcData.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/IPmcData.d.ts index f834822..a9594d6 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/IPmcData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/IPmcData.d.ts @@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase" export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IAchievement.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: 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 8ff3ba9..cfcc831 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -1,6 +1,8 @@ import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; @@ -17,14 +19,15 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; @@ -35,6 +38,13 @@ export interface IBotBase { /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -44,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -127,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -170,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -202,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -311,6 +316,8 @@ export interface Productive { sptIsComplete?: boolean; /** Is the craft a Continuous, e.g bitcoins/water collector */ sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -330,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -351,6 +359,8 @@ export interface LastCompleted { export interface Notes { Notes: Note[]; } +export interface CarExtractCounts { +} export declare enum SurvivorClass { UNKNOWN = 0, NEUTRALIZER = 1, @@ -382,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -390,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; 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 53a8021..db6e56e 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -119,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -159,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IItem.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IItem.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IProfileTemplate.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IProfileTemplate.d.ts index 35db121..9a1eb01 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -11,10 +11,10 @@ export interface IProfileTemplates { } export interface IProfileSides { descriptionLocaleKey: string; - usec: TemplateSide; - bear: TemplateSide; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -22,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; 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 edd9849..7e576ce 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts @@ -7,7 +7,7 @@ export interface IQuest { QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: 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 8101c51..854c8ef 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,183 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: string; - traderId: string; - location: string; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - questStatus: any; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - acceptPlayerMessage: string; - declinePlayerMessage: string; - completePlayerMessage: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; - sptRepatableGroupName?: string; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter?: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface IPickup extends IRepeatableQuest { - conditions: IPickupConditions; -} -export interface IPickupConditions extends IConditions { - AvailableForFinish: IPickupAvailableFor[]; -} -export interface IPickupAvailableFor extends IAvailableFor { - _props: IPickupAvailableForProps; -} -export interface IPickupAvailableForProps extends IAvailableForPropsCounter { - target: string[]; - counter?: IPickupCounter; -} -export interface IPickupCounter extends ICounter { - conditions: IPickupCondition[]; -} -export interface IPickupCondition extends ICondition { - _props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IEquipmentConditionProps extends IConditionProps { - equipmentInclusive: [string[]]; - IncludeNotEquippedItems: boolean; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; - weapon?: string[]; - weaponCategories?: string[]; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -240,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts index c17c7a0..2ccecbe 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: 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 83353de..38f2a43 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutArea.d.ts b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutArea.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/TypeScript/9RouterHooks/types/models/eft/hideout/IQteData.d.ts b/TypeScript/9RouterHooks/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/TypeScript/9RouterHooks/types/models/eft/hideout/IQteData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 49a6792..a7ec78b 100644 --- a/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/ISetFavoriteItems.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index c5459ff..bcf26ef 100644 --- a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/TypeScript/9RouterHooks/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/TypeScript/9RouterHooks/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/TypeScript/9RouterHooks/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/TypeScript/9RouterHooks/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/TypeScript/9RouterHooks/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index d54116a..3ce8733 100644 --- a/TypeScript/9RouterHooks/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/TypeScript/9RouterHooks/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/TypeScript/9RouterHooks/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts index 78302ee..441308f 100644 --- a/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts @@ -17,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -34,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -140,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -195,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IGetAchievementsResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/quests/IFailQuestRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/TypeScript/9RouterHooks/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/TypeScript/9RouterHooks/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index cc4336a..15813c1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "" | "SptInsure" | "SptRepair"; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/TypeScript/9RouterHooks/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/TypeScript/9RouterHooks/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index 1fc6025..0101dc1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts index b47189d..cae98f1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts @@ -4,6 +4,7 @@ export interface IWeatherData { time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts index a9acb69..6d2106b 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -95,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/TypeScript/9RouterHooks/types/models/enums/BonusSkillType.d.ts b/TypeScript/9RouterHooks/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/BonusType.d.ts b/TypeScript/9RouterHooks/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/TypeScript/9RouterHooks/types/models/enums/ELocationName.d.ts b/TypeScript/9RouterHooks/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/TypeScript/9RouterHooks/types/models/enums/ELocationName.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts b/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts index f43d4ba..f8a8b5a 100644 --- a/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts @@ -23,5 +23,7 @@ export declare enum ItemEventActions { REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", - REDEEM_PROFILE_REWARD = "RedeemProfileReward" + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/TypeScript/9RouterHooks/types/models/enums/MessageType.d.ts b/TypeScript/9RouterHooks/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/TypeScript/9RouterHooks/types/models/enums/MessageType.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/TypeScript/9RouterHooks/types/models/enums/ModSpawn.d.ts b/TypeScript/9RouterHooks/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/SeasonalEventType.d.ts b/TypeScript/9RouterHooks/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/TypeScript/9RouterHooks/types/models/enums/SeasonalEventType.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/TypeScript/9RouterHooks/types/models/enums/TraderServiceType.d.ts b/TypeScript/9RouterHooks/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/Traders.d.ts b/TypeScript/9RouterHooks/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/TypeScript/9RouterHooks/types/models/enums/Traders.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/QteActivityType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/QteEffectType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/QteResultType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/QteRewardType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/QteType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/hideout/RequirementType.d.ts b/TypeScript/9RouterHooks/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadMod.d.ts b/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadMod.d.ts index cc8f7af..87a2ab0 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadMod.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadModAsync.d.ts b/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadModAsync.d.ts index 44700e1..ea57e2b 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/9RouterHooks/types/models/external/IPostDBLoadMod.d.ts b/TypeScript/9RouterHooks/types/models/external/IPostDBLoadMod.d.ts index f2f43ab..8b482b6 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPostDBLoadMod.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/TypeScript/9RouterHooks/types/models/external/IPostDBLoadModAsync.d.ts b/TypeScript/9RouterHooks/types/models/external/IPostDBLoadModAsync.d.ts index ed06ed5..63b55bb 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPostDBLoadModAsync.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadMod.d.ts b/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadMod.d.ts index e81b660..b3bb041 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadMod.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadModAsync.d.ts b/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadModAsync.d.ts index 89a3e67..4c0c984 100644 --- a/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: 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; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts index 58a1bd1..54c9ff7 100644 --- a/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts index 1975cf7..8efb870 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBTRConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBaseConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBaseConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts index 517ec27..d326b38 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts @@ -6,14 +6,14 @@ export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -33,6 +33,12 @@ export interface IBotConfig extends IBaseConfig { chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -73,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -94,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -105,7 +121,8 @@ export interface EquipmentFilters { /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; /** Should the stock mod be forced to spawn on bot */ - forceStock: boolean; + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -117,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -138,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotDurability.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotDurability.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts index 68fbc14..74604b0 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,6 +16,37 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts index 5386fb3..249c79a 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInRaidConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInRaidConfig.d.ts index 5b60526..cc6feca 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInRaidConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInRaidConfig.d.ts @@ -16,8 +16,12 @@ export interface IInRaidConfig extends IBaseConfig { coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -26,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInsuranceConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInsuranceConfig.d.ts index ffd0245..794abb7 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInsuranceConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts index 6f1498d..bc64719 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts index 506ee76..40daa68 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts @@ -3,6 +3,9 @@ export interface IItemConfig extends IBaseConfig { kind: "aki-item"; /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts index 78e1cfb..bf57df6 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts index 5c804a4..407bef4 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts @@ -34,10 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; +} +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -78,6 +87,7 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; } export interface IContainerRandomistionSettings { enabled: boolean; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILostOnDeathConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILostOnDeathConfig.d.ts index ad7e7b9..d440e91 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IPlayerScavConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IPlayerScavConfig.d.ts index 7f587e0..e5abca2 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IPlayerScavConfig.d.ts @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts index d67e6c2..65da29b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index 14d77f1..33dee7b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; -import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,9 +18,7 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } @@ -32,13 +32,6 @@ export interface Chance { /** Min possible sell chance % for a player listed offer */ minSellChancePercent: number; } -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; -} export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ @@ -65,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -82,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -98,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -119,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -134,9 +129,30 @@ export interface Blacklist { enableQuestList: boolean; /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts index 4ac903b..6334570 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { @@ -6,6 +7,8 @@ export interface ISeasonalEventConfig extends IBaseConfig { /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts index 29b3d2d..73bd5a8 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts @@ -5,29 +5,34 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -37,6 +42,11 @@ export interface FenceConfig { blacklistSeasonalItems: boolean; blacklist: string[]; coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; } export interface CoopExtractReward extends LootRequest { sendGift: boolean; @@ -47,4 +57,6 @@ export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts index 10f5459..3e8f282 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts @@ -5,6 +5,7 @@ export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/TypeScript/9RouterHooks/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/TypeScript/9RouterHooks/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/generators/IBotGenerator.d.ts b/TypeScript/9RouterHooks/types/models/spt/generators/IBotGenerator.d.ts index 8c0b979..2cb337d 100644 --- a/TypeScript/9RouterHooks/types/models/spt/generators/IBotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/generators/IBotGenerator.d.ts @@ -3,8 +3,3 @@ import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/table export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/TypeScript/9RouterHooks/types/models/spt/mod/IPackageJsonData.d.ts b/TypeScript/9RouterHooks/types/models/spt/mod/IPackageJsonData.d.ts index b07d00e..0f6f26c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/mod/IPackageJsonData.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/mod/IPackageJsonData.d.ts @@ -5,6 +5,7 @@ export interface IPackageJsonData { dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; diff --git a/TypeScript/9RouterHooks/types/models/spt/server/ExhaustableArray.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/server/IDatabaseTables.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/IDatabaseTables.d.ts index 98a0dbd..8f0ff07 100644 --- a/TypeScript/9RouterHooks/types/models/spt/server/IDatabaseTables.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; @@ -16,7 +17,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; import { ILocations } from "@spt-aki/models/spt/server/ILocations"; import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/TypeScript/9RouterHooks/types/models/spt/server/ILocations.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/ILocations.d.ts index 9987d8c..a52242f 100644 --- a/TypeScript/9RouterHooks/types/models/spt/server/ILocations.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; -import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/TypeScript/9RouterHooks/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/services/ITraderServiceModel.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts index f277553..d4fa902 100644 --- a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/9RouterHooks/types/models/spt/utils/IUuidGenerator.d.ts b/TypeScript/9RouterHooks/types/models/spt/utils/IUuidGenerator.d.ts deleted file mode 100644 index 3870469..0000000 --- a/TypeScript/9RouterHooks/types/models/spt/utils/IUuidGenerator.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts index 6c770ec..ef0a251 100644 --- a/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts @@ -5,13 +5,15 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** * @param info Event request * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts index 8775212..14aeddc 100644 --- a/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -6,5 +6,5 @@ export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts index cb93d29..22fddbf 100644 --- a/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -8,5 +8,5 @@ export declare class InventoryItemEventRouter extends ItemEventRouterDefinition protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/routers/item_events/PresetBuildItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/item_events/PresetBuildItemEventRouter.d.ts deleted file mode 100644 index d5dbf9d..0000000 --- a/TypeScript/9RouterHooks/types/routers/item_events/PresetBuildItemEventRouter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; -export declare class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - protected presetBuildCallbacks: PresetBuildCallbacks; - constructor(presetBuildCallbacks: PresetBuildCallbacks); - getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; -} diff --git a/TypeScript/9RouterHooks/types/routers/static/AchievementStaticRouter.d.ts b/TypeScript/9RouterHooks/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/TypeScript/9RouterHooks/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/TypeScript/9RouterHooks/types/routers/static/BuildStaticRouter.d.ts b/TypeScript/9RouterHooks/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/TypeScript/9RouterHooks/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/TypeScript/9RouterHooks/types/routers/static/PresetStaticRouter.d.ts b/TypeScript/9RouterHooks/types/routers/static/PresetStaticRouter.d.ts deleted file mode 100644 index cac8da6..0000000 --- a/TypeScript/9RouterHooks/types/routers/static/PresetStaticRouter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PresetBuildCallbacks } from "@spt-aki/callbacks/PresetBuildCallbacks"; -import { StaticRouter } from "@spt-aki/di/Router"; -export declare class PresetStaticRouter extends StaticRouter { - protected presetCallbacks: PresetBuildCallbacks; - constructor(presetCallbacks: PresetBuildCallbacks); -} diff --git a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts index 20b7999..8574cdd 100644 --- a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts @@ -1,5 +1,5 @@ /// -import http, { IncomingMessage, ServerResponse } from "node:http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts b/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts index 88a9b26..d61259b 100644 --- a/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts @@ -75,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts b/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts index e0bf025..3fe89af 100644 --- a/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts @@ -2,6 +2,7 @@ import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -9,7 +10,6 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts index f0cc787..c66607f 100644 --- a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts @@ -2,7 +2,7 @@ import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts index fb84ede..e2c0a35 100644 --- a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @returns IBotBase object */ getBot(key: string): IBotBase; + /** + * Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + * @param botToStore Bot object to store + */ + storeUsedBot(botToStore: IBotBase): void; + /** + * Get a bot by its profileId that has been generated and sent to client for current raid + * Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + * @param profileId Id of bot to get + * @returns IBotBase + */ + getUsedBot(profileId: string): IBotBase; /** * Remove all cached bot profiles from memory */ diff --git a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts index a2205f3..b013e5e 100644 --- a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index 63cd726..bb1d035 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -1,18 +1,17 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; -import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; -import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -22,7 +21,6 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + /** Time when some items in assort will be replaced */ + protected nextPartialRefreshTimestamp: number; /** Main assorts you see at all rep levels */ protected fenceAssort: ITraderAssort; - /** Assorts shown on a separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: 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, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @param assort (clone)Assort that contains items with prices to adjust * @param itemMultipler multipler to use on items * @param presetMultiplier preset multipler to use on presets */ - protected adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort root items to pick from to remove + */ + protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; /** * Get an integer rounded count of items to replace based on percentrage from traderConfig value * @param totalItemCount total item count @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * Create object that contains calculated fence assort item values to make based on config + * Stored in this.desiredAssortCounts + */ + protected createInitialFenceAssortGenerationValues(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object */ - protected createBaseTraderAssortItem(): ITraderAssort; + protected createFenceAssortSkeleton(): ITraderAssort; /** * Hydrate assorts parameter object with generated assorts * @param assortCount Number of assorts to generate * @param assorts object to add created assorts to */ - protected createAssorts(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; + /** + * Find an assort item that matches the first parameter, also matches based on upd properties + * e.g. salewa hp resource units left + * @param rootItemBeingAdded item to look for a match against + * @param itemDbDetails Db details of matching item + * @param fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * Should this item be forced into only 1 stack on fence + * @param existingItem Existing item from fence assort + * @param itemDbDetails Item we want to add db details + * @returns True item should be force stacked + */ + protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; + /** + * Adjust price of item based on what is left to buy (resource/uses left) + * @param barterSchemes All barter scheme for item having price adjusted + * @param itemRoot Root item having price adjusted + * @param itemTemplate Db template of item + */ + protected adjustItemPriceByQuality(barterSchemes: Record, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * Find presets in base fence assort and add desired number to 'assorts' parameter + * @param desiredWeaponPresetsCount + * @param assorts Assorts to add preset to + * @param baseFenceAssort Base data to draw from + * @param loyaltyLevel Which loyalty level is required to see/buy item + */ + protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; + /** + * Adjust plate / soft insert durability values + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @param itemToAdjust Item being edited */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void; + /** + * Generate a randomised current and max durabiltiy value for an armor item + * @param itemDetails Item to create values for + * @param equipmentDurabilityLimits Max durabiltiy percent min/max values + * @returns Durability + MaxDurability values + */ + protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts b/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts deleted file mode 100644 index 0097c96..0000000 --- a/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { VFS } from "@spt-aki/utils/VFS"; -export declare class HashCacheService { - protected vfs: VFS; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected logger: ILogger; - protected jsonHashes: any; - protected modHashes: any; - protected readonly modCachePath = "./user/cache/modCache.json"; - constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); - /** - * Return a stored hash by key - * @param modName Name of mod to get hash for - * @returns Mod hash - */ - getStoredModHash(modName: string): string; - /** - * Does the generated hash match the stored hash - * @param modName name of mod - * @param modContent - * @returns True if they match - */ - modContentMatchesStoredHash(modName: string, modContent: string): boolean; - hashMatchesStoredHash(modName: string, modHash: string): boolean; - storeModContent(modName: string, modContent: string): void; - storeModHash(modName: string, modHash: string): void; -} diff --git a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts index fa13e9c..7148969 100644 --- a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts @@ -9,6 +9,8 @@ import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -16,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @@ -25,6 +28,7 @@ export declare class InsuranceService { protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * Create insurance equipment packages that should be sent to the user. The packages should contain items that have + * been lost in a raid and should be returned to the player through the insurance system. + * + * NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the + * profile at the start of the raid to return to the player in insurance. Because of this, the item + * positioning may differ from the position the item was in when the player died. Apart from removing all + * positioning, this is the best we can do. >:{} + * + * @param pmcData Player profile + * @param offraidData Post-raid data + * @param preRaidGear Pre-raid data * @param sessionID Session id - * @param playerDied did the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[]; + /** + * Take the insurance item packages within a profile session and ensure that each of the items in that package are + * not orphaned from their parent ID. + * + * @param sessionID The session ID to update insurance equipment packages in. + * @returns void + */ + protected adoptOrphanedInsEquipment(sessionID: string): void; + /** + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + * @param equipmentPkg Gear to store - generated by getGearLostInRaid() + */ + storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void; /** * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * @param pmcData Player profile - * @param insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid + * @param allItemsFromClient Item data when player left raid (durability values) + * @returns Item (with children) to send to player */ protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; + /** + * Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts b/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts index 791bb34..dea17d7 100644 --- a/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts @@ -15,6 +15,17 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(tpl: string): boolean; + /** + * Check if item is blacklisted from being a reward for player + * @param tpl item tpl to check is on blacklist + * @returns True when blacklisted + */ + isItemRewardBlacklisted(tpl: string): boolean; + /** + * Get an array of items that should never be given as a reward to player + * @returns string array of item tpls + */ + getItemRewardBlacklist(): string[]; /** * Return every template id blacklisted in config/item.json * @returns string array of blacklisted tempalte ids diff --git a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts index 5ee5540..023e61d 100644 --- a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts +++ b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts @@ -33,9 +33,21 @@ export declare class LocaleService { * @returns array of locales e.g. en/fr/cn */ getServerSupportedLocales(): string[]; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getLocaleFallbacks(): { + [locale: string]: string; + }; + /** + * Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + * @returns string + */ + protected getPlatformForServerLocale(): string; /** * Get the locale of the computer running the server * @returns langage part of locale e.g. 'en' part of 'en-US' */ - protected getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts index 939db6f..c12e465 100644 --- a/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts +++ b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts @@ -1,5 +1,4 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocaleService } from "@spt-aki/services/LocaleService"; @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/TypeScript/9RouterHooks/types/services/MatchLocationService.d.ts b/TypeScript/9RouterHooks/types/services/MatchLocationService.d.ts index 8f7b3bf..43a66be 100644 --- a/TypeScript/9RouterHooks/types/services/MatchLocationService.d.ts +++ b/TypeScript/9RouterHooks/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts index b8f2a37..51508ac 100644 --- a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ import ts from "typescript"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { HashCacheService } from "@spt-aki/services/HashCacheService"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod diff --git a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts index d6b22ed..84d9244 100644 --- a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts @@ -11,9 +11,11 @@ import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcess import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @param pmcData Pmc profile + * @param request Buy item request + * @param sessionID Session id + * @param output Client response */ - payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get the item price of a specific traders assort * @param traderAssortId Id of assort to look up @@ -41,19 +43,13 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; - /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** * Remove currency from player stash/inventory and update client object with changes * @param pmcData Player profile to find and remove currency from @@ -61,9 +57,8 @@ export declare class PaymentService { * @param amountToPay money value to pay * @param sessionID Session id * @param output output object to send to client - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts b/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts index b5a0b8b..1d38e2c 100644 --- a/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts @@ -8,9 +8,11 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id diff --git a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts index e2e140b..804b3bf 100644 --- a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts @@ -47,10 +47,10 @@ export declare class ProfileFixerService { */ checkForAndFixScavProfileIssues(scavProfile: IPmcData): void; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void; protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -64,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(pmcProfile: IPmcData): void; + /** + * Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + * @param pmcProfile Player profile to check + */ + protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void; protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]; protected fixNullTraderSalesSums(pmcProfile: IPmcData): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; @@ -98,11 +102,6 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -161,4 +160,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to migrate improvements in */ protected migrateImprovements(pmcProfile: IPmcData): void; + /** + * After removing mods that add quests, the quest panel will break without removing these + * @param pmcProfile Profile to remove dead quests from + */ + protected removeOrphanedQuests(pmcProfile: IPmcData): void; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts index ce86ee3..80bf353 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts @@ -1,7 +1,6 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -25,6 +24,7 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; @@ -38,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; + /** + * Get total count of current expired offers + * @returns Number of expired offers + */ getExpiredOfferCount(): number; /** - * Get an array of expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -76,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts index 3e91d52..5649751 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts @@ -5,9 +5,10 @@ import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { MinMax } from "@spt-aki/models/common/MinMax"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getFleaPriceForItem(tplId: string): number; + /** + * Get the flea price for an offers items + children + * @param offerItems offer item + children to process + * @returns Rouble price + */ + getFleaPriceForOfferItems(offerItems: Item[]): number; /** * get the dynamic (flea) price for an item * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @param offerItems Item with mods to get price for * @param desiredCurrency Currency price desired in * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * using data from config, adjust an items price to be relative to its handbook price + * @param handbookPrices Prices of items in handbook + * @param unreasonableItemChange Change object from config + * @param itemTpl Item being adjusted + * @param price Current price of item + * @returns Adjusted price of item + */ + protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number; /** * Get different min/max price multipliers for different offer types (preset/pack/default) * @param isPreset Offer is a preset @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json * @param itemPrice price of item * @param itemTpl item template Id being checked * @returns adjusted price value in roubles @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset - * @param item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number; /** * Get the highest price for an item that is stored in handbook or trader assorts * @param itemTpl Item to get highest price of @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts index 3d030c2..6749c68 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts @@ -1,4 +1,5 @@ import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; export declare class RagfairRequiredItemsService { @@ -7,6 +8,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItemsById(searchId: string): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairTaxService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairTaxService.d.ts index e72228f..dd9cc5f 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairTaxService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairTaxService.d.ts @@ -16,6 +16,16 @@ export declare class RagfairTaxService { storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; clearStoredOfferTaxById(offerIdToRemove: string): void; getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; + /** + // This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + // It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + * @param item Item being sold on flea + * @param pmcData player profile + * @param requirementsValue + * @param offerItemCount Number of offers being created + * @param sellInOnePiece + * @returns Tax in roubles + */ calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/TypeScript/9RouterHooks/types/services/RepairService.d.ts b/TypeScript/9RouterHooks/types/services/RepairService.d.ts index cb0070f..cc90eee 100644 --- a/TypeScript/9RouterHooks/types/services/RepairService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RepairService.d.ts @@ -9,6 +9,7 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -82,11 +83,11 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number; /** * Should a repair kit apply total durability loss on repair * @param pmcData Player profile @@ -125,12 +126,12 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @returns durability multiplier value */ protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number; } diff --git a/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts b/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts index 3e20409..4c51bab 100644 --- a/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts +++ b/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts @@ -6,6 +6,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; @@ -24,8 +25,11 @@ export declare class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; - protected halloweenEventActive: any; - protected christmasEventActive: any; + protected weatherConfig: IWeatherConfig; + protected halloweenEventActive: boolean; + protected christmasEventActive: boolean; + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[]; constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -48,11 +52,12 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * Get an array of seasonal items that should not appear + * e.g. if halloween is active, only return christmas items + * or, if halloween and christmas are inactive, return both sets of items * @returns array of tpl strings */ - getAllSeasonalEventItems(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active @@ -99,10 +104,10 @@ export declare class SeasonalEventService { protected cacheActiveEvents(): 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 botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -110,6 +115,9 @@ export declare class SeasonalEventService { * @param eventName Name of the event to enable. e.g. Christmas */ protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + protected adjustZryachiyMeleeChance(): void; + protected enableHalloweenSummonEvent(): void; + protected addEventBossesToMaps(eventType: SeasonalEventType): void; /** * Change trader icons to be more event themed (Halloween only so far) * @param eventType What event is active @@ -139,4 +147,11 @@ export declare class SeasonalEventService { * @param giftkey Key of gift to give */ protected giveGift(playerId: string, giftkey: string): void; + /** + * Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + * @param eventBotRole Event bot role type + * @returns Bot role as string + */ + getBaseRoleForEventBot(eventBotRole: string): string; + enableSnow(): void; } diff --git a/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts index cd7518c..92aaec3 100644 --- a/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts @@ -11,11 +12,12 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected profileHelper: ProfileHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Get a purchase made from a trader for requested profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @param assortId Id of assort to get data for + * @returns TraderPurchaseData + */ + getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts b/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/TypeScript/9RouterHooks/types/services/cache/BundleHashCacheService.d.ts b/TypeScript/9RouterHooks/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): number; + storeValue(key: string, value: number): void; + matchWithStoredHash(bundlePath: string, hash: number): boolean; + calculateAndMatchHash(bundlePath: string): boolean; + calculateAndStoreHash(bundlePath: string): void; +} diff --git a/TypeScript/9RouterHooks/types/services/cache/ModHashCacheService.d.ts b/TypeScript/9RouterHooks/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + protected readonly modCachePath = "./user/cache/modCache.json"; + constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + getStoredValue(key: string): string; + storeValue(key: string, value: string): void; + matchWithStoredHash(modName: string, hash: string): boolean; + calculateAndCompareHash(modName: string, modContent: string): boolean; + calculateAndStoreHash(modName: string, modContent: string): void; +} diff --git a/TypeScript/9RouterHooks/types/services/mod/CustomItemService.d.ts b/TypeScript/9RouterHooks/types/services/mod/CustomItemService.d.ts index 29329dc..fe9c16c 100644 --- a/TypeScript/9RouterHooks/types/services/mod/CustomItemService.d.ts +++ b/TypeScript/9RouterHooks/types/services/mod/CustomItemService.d.ts @@ -4,6 +4,7 @@ import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetail import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { @@ -12,8 +13,9 @@ export declare class CustomItemService { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * Create a new item from a cloned item base * WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start @@ -79,6 +81,11 @@ export declare class CustomItemService { * @param fleaPriceRoubles Price of the new item */ protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void; + /** + * Add a weapon to the hideout weapon shelf whitelist + * @param newItemId Weapon id to add + */ + protected addToWeaponShelf(newItemId: string): void; /** * Add a custom weapon to PMCs loadout * @param weaponTpl Custom weapon tpl to add to PMCs diff --git a/TypeScript/9RouterHooks/types/utils/HashUtil.d.ts b/TypeScript/9RouterHooks/types/utils/HashUtil.d.ts index c51fb5c..d428072 100644 --- a/TypeScript/9RouterHooks/types/utils/HashUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/HashUtil.d.ts @@ -1,5 +1,7 @@ /// +/// import crypto from "node:crypto"; +import fs from "node:fs"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts b/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts index 4296fe4..222d204 100644 --- a/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts @@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts b/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts index 9868c1e..318e98b 100644 --- a/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts @@ -27,5 +27,12 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts index f3c9957..3942ed1 100644 --- a/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts index 3552fb4..9236773 100644 --- a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts @@ -131,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -149,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -170,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts b/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/TypeScript/9RouterHooks/types/utils/UUidGenerator.d.ts b/TypeScript/9RouterHooks/types/utils/UUidGenerator.d.ts deleted file mode 100644 index 0d9ad2f..0000000 --- a/TypeScript/9RouterHooks/types/utils/UUidGenerator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; -export declare class UUidGenerator implements IUUidGenerator { - generate(): string; -} diff --git a/TypeScript/9RouterHooks/types/utils/VFS.d.ts b/TypeScript/9RouterHooks/types/utils/VFS.d.ts index eefcccb..d880bf5 100644 --- a/TypeScript/9RouterHooks/types/utils/VFS.d.ts +++ b/TypeScript/9RouterHooks/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "node:fs"; import "reflect-metadata"; +import fs from "node:fs"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts index 703d7bc..eb24706 100644 --- a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts +++ b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts @@ -18,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -40,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/TypeScript/9RouterHooks/types/utils/collections/lists/LinkedList.d.ts b/TypeScript/9RouterHooks/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/TypeScript/9RouterHooks/types/utils/collections/lists/LinkedList.d.ts +++ b/TypeScript/9RouterHooks/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/TypeScript/9RouterHooks/types/utils/collections/lists/Nodes.d.ts b/TypeScript/9RouterHooks/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/TypeScript/9RouterHooks/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/TypeScript/9RouterHooks/types/utils/collections/queue/Queue.d.ts b/TypeScript/9RouterHooks/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/TypeScript/9RouterHooks/types/utils/collections/queue/Queue.d.ts +++ b/TypeScript/9RouterHooks/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/TypeScript/9RouterHooks/types/utils/logging/AbstractWinstonLogger.d.ts b/TypeScript/9RouterHooks/types/utils/logging/AbstractWinstonLogger.d.ts index 4d2eba7..11179b0 100644 --- a/TypeScript/9RouterHooks/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/TypeScript/9RouterHooks/types/utils/logging/AbstractWinstonLogger.d.ts @@ -7,10 +7,8 @@ import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/TypeScript/9RouterHooks/types/utils/logging/WinstonMainLogger.d.ts b/TypeScript/9RouterHooks/types/utils/logging/WinstonMainLogger.d.ts index ae1b6fc..53cd9d3 100644 --- a/TypeScript/9RouterHooks/types/utils/logging/WinstonMainLogger.d.ts +++ b/TypeScript/9RouterHooks/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/TypeScript/9RouterHooks/types/utils/logging/WinstonRequestLogger.d.ts b/TypeScript/9RouterHooks/types/utils/logging/WinstonRequestLogger.d.ts index be14f1b..45bc436 100644 --- a/TypeScript/9RouterHooks/types/utils/logging/WinstonRequestLogger.d.ts +++ b/TypeScript/9RouterHooks/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "@spt-aki/models/spt/utils/IUuidGenerator"; import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean;